DOCUMENTATION: https://docs.djangoproject.com/en/3.0/
django-admin startproject <NAME> → start your django project
virtualenv myvenv → creates virtual environment
source myvenv/bin/activate → activates virtual environment
django-admin startapp <NAME> → creates an app in your project
python manage.py runserver → runs localhost server → localhost:8000
python manage.py createsuperuser → creates superuser for admin
python manage.py makemigrations → commits/makes migrations
python manage.py migrate → pushes/migrates changes
create a templates folder in your app, this is where all your pages/html files will go
create a static folder, this will hold css folder and images folder
STATIC SETUP
put this in settings.py
STATIC_URL = '/static/'
MEDIA_URL = '/images/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
MEDIA_ROOT = os.path.join(BASE_DIR, 'static/images')
put this to connect images in urls.py
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
link: https://docs.djangoproject.com/en/3.0/ref/models/querysets/
has functions like .all(), .get(), count()
think of it like version control, makemigrations is the commit, migrate is push
every time you update your model, makemigrations and migrate
also dont forget to update your forms.py ← only if you used an HTML Form