For Windows users, use the following steps (you are free to use Conda
environments if you want to) :
pip install virtualenv
cd my-django-project
virtualenv venv
venv\Scripts\activate.bat
pip install django
For others, follow the following steps:
pip3 install virtualenv
cd my-django-project
virtualenv venv
source venv/bin/activate
pip3 install django
- Create a new project :
django-admin startproject sample
- Create a new app :
python manage.py startapp app
- Add the app name to
settings.py
under INSTALLED_APPS - Create a
urls.py
file inside app - Link the
urls.py
file of the project to theurls.py
file of the app - Create the templates, static folders
- Add the TEMPLATES_DIR, STATICFILES_DIRS = [STATIC_DIR,] in
settings.py
file - Create the
base.html
, and remember to {% load static %} in every html to make use of the templating engine - Create the models using classes, remember to put in
__str__
- In the admin page, add these models
- Migration time
- Create views inside
views.py
, use templating to create dynamic webpages - Map URLs to each view you've created
- Populate the database with faker
- Migration time DONE!