updated readme for linux users

This commit is contained in:
Linden Crandall 2023-08-17 14:00:00 +09:00
parent 5ce795ce14
commit cfba0dae32

View File

@ -1,7 +1,7 @@
# Selah Django backend API # Selah Django backend API
*** DJANGO ENVIRONMENT LOCAL SETUP (installing libraries/dependencies) *** *** LOCAL DJANGO ENVIRONMENT SETUP (installing libraries/dependencies) ***
- install ffmpeg for audio file processing on your system (ubuntu): - install ffmpeg for audio file processing on your system (ubuntu):
@ -67,10 +67,9 @@ pip install gunicorn
- install pgadmin4 desktop GUI tool for DB management (https://www.pgadmin.org/download/): - install pgadmin4 desktop GUI tool for DB management (https://www.pgadmin.org/download/):
*** Note: You need to create empty DB in either psql shell or pgadmin tool before running python manage.py makemigrations and python manage.py migrate (If you want to use custom user model, DO NOT RUN python manage.py makemigrations/migrate until you have created your custom user model, otherwise Django will revert to its default User Model. Changing from Django's default user model to a custom user model is possible, but unsupported and prone to many errors. Do this first before anything else if that's what you want for your app) *** Note: You need to create and configure an empty DB in either psql shell or pgadmin tool and give it the name `selah_dev_db` before running `python manage.py makemigrations` and/or `python manage.py migrate`
- make sure env is activated and start Django dev server: - in the `main_project` directory, create a new `.env` file with the following environmnt variables. Get actual values from me:
- in the `main_project` directory, create a new `.env` file with the following variables. Get values from me:
``` ```
DEV_MODE= DEV_MODE=
DOMAIN= DOMAIN=
@ -82,34 +81,41 @@ EMAIL_PORT=
EMAIL_HOST_USER= EMAIL_HOST_USER=
EMAIL_HOST_PASSWORD= EMAIL_HOST_PASSWORD=
SECRET_KEY= SECRET_KEY=
DBENGINE= DBENGINE=django.db.backends.postgresql
DBNAME= DBNAME=selah_dev_db
DBUSER= DBUSER=<YOUR LOCAL POSTGRES USER>
DBPASSWORD= DBPASSWORD=<YOUR LOCAL POSTGRES PASSWORD>
DBHOST= DBHOST=127.0.0.1
STRIPE_DOMAIN= STRIPE_DOMAIN=
STRIPEPK= STRIPEPK=
STRIPESK= STRIPESK=
STRIPE_WEBHOOK_SECRET= STRIPE_WEBHOOK_SECRET=
SECURE_SSL_REDIRECT= SECURE_SSL_REDIRECT=False
SESSION_COOKIE_SECURE= SESSION_COOKIE_SECURE=False
CSRF_COOKIE_SECURE= CSRF_COOKIE_SECURE=False
ADMIN_URL= ADMIN_URL=
``` ```
set backend env DEV_MODE var:
DEV_MODE=True - make sure env is activated and set backend env DEV_MODE var:
`DEV_MODE=True`
- start Django dev server in terminal: - cd to `/backned` directory where the `manage.py` file is and start Django dev server in terminal:
DJANGO_SETTINGS_MODULE=main_project.dev_settings python manage.py runserver `DJANGO_SETTINGS_MODULE=main_project.dev_settings python manage.py runserver`
- you should be able to access backend at - you should be able to access backend at
127.0.0.1:8000 `127.0.0.1:8000/api/selah`
- to create a superuser for youself so you can sign into Django's built-in admin portal to manage database models, activate env and run:
`python manage.py createsuperuser`
- follow the prompts to create your superuser and try to access the admin portal at
``127.0.0.1:8000/api/admin`
To run vs code debugger: - To run vs code debugger:
In top level directory, add this launch.json file: In top level directory, add this launch.json file:
``` ```