Qrrie Project Steps
Instructions
- create a new repository
- clone repository to local machine
- open repo in vscode
-
define requirements
django pillow qrcode[PIL] uvicorn dotenv -
install requirements
- type
ctrl+shift+p - type install environment and select "Python: Create Environment"
- select your project folder in the top bar, if asked
- select "quick create"
- wait for install to complete
- type
- right click on requirements.txt in project explorer and select "open in integrated terminal"
-
type the following:
django-admin startproject qrrie cd qrrie python3 manage.py startapp qr -
create django secret key:
KEY=$(python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())') echo "DJANGO_SECRET_KEY='$KEY'">>my_env.env -
add my_env.env to ignore list
echo "*.env" >> .gitignore
-
edit qrrie/qrrie/settings.py
-
import os. At the top of the file, just below
from pathlib import Path, add the following:import os -
comment out temp secret key and add environment-based secret key
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY') -
Update timezone
#TIME_ZONE = 'UTC' TIME_ZONE = 'America/Los_Angeles' -
add qrrie app to
INSTALLED_APPS:INSTALLED_APPS = [W 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'qr.apps.QrConfig', ] -
add
APPEND_SLASHAPPEND_SLASH = True
-
-
edit qrrie/qrrie/urls.py. Modify the code so it matches the following:
python3 manage.py runserver 0.0.0.0:8000 -
create run script
cat << EOF | tee run #!/usr/bin/bash source my_env.env python3 qrrie/manage.py runserver 0.0.0.0:8000 EOF chmod +x run./run -
Create superuser. Type the following in bash:
python manage.py createsuperuserand follow interactive instructions