Installation of Django on Virtual Environment
Install virtualenv
virtualenv environmentname
Note:- environmentname can be replace by any name you want for your environment.
Activate
environmentname\Scripts\activate
Note:- To deactivate virtual environment use following command.
deactivate
Install Django
pip install django
Verify your Django Installation
django-admin –version
Create Project in Django
django-admin startproject projectname
Note:- Replace projectname with the name of the project you want create.
Structure of The Project.
projectname/
manage.py
projectname/
_init_.py
settings.py
urls.py
asgi.py
wsgi.py
Create App in your Project
python manage.py startapp appname
Note:- Replace appname with the name of the App you want create.
Structure of The App.
appname/
_init_.py
admin.py
apps.py
migrations/
_init_.py
models.py
tests.py
_init_.py
admin.py
apps.py
migrations/
_init_.py
models.py
tests.py
views.py
Run Server
python manage.py runserver