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.pyunder INSTALLED_APPS - Create a
urls.pyfile inside app - Link the
urls.pyfile of the project to theurls.pyfile of the app - Create the templates, static folders
- Add the TEMPLATES_DIR, STATICFILES_DIRS = [STATIC_DIR,] in
settings.pyfile - 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!