|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
# 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):
|
|
|
|
@ -67,10 +67,9 @@ pip install gunicorn
|
|
|
|
|
- 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 variables. Get values from me:
|
|
|
|
|
- in the `main_project` directory, create a new `.env` file with the following environmnt variables. Get actual values from me:
|
|
|
|
|
```
|
|
|
|
|
DEV_MODE=
|
|
|
|
|
DOMAIN=
|
|
|
|
@ -82,34 +81,41 @@ EMAIL_PORT=
|
|
|
|
|
EMAIL_HOST_USER=
|
|
|
|
|
EMAIL_HOST_PASSWORD=
|
|
|
|
|
SECRET_KEY=
|
|
|
|
|
DBENGINE=
|
|
|
|
|
DBNAME=
|
|
|
|
|
DBUSER=
|
|
|
|
|
DBPASSWORD=
|
|
|
|
|
DBHOST=
|
|
|
|
|
DBENGINE=django.db.backends.postgresql
|
|
|
|
|
DBNAME=selah_dev_db
|
|
|
|
|
DBUSER=<YOUR LOCAL POSTGRES USER>
|
|
|
|
|
DBPASSWORD=<YOUR LOCAL POSTGRES PASSWORD>
|
|
|
|
|
DBHOST=127.0.0.1
|
|
|
|
|
STRIPE_DOMAIN=
|
|
|
|
|
STRIPEPK=
|
|
|
|
|
STRIPESK=
|
|
|
|
|
STRIPE_WEBHOOK_SECRET=
|
|
|
|
|
SECURE_SSL_REDIRECT=
|
|
|
|
|
SESSION_COOKIE_SECURE=
|
|
|
|
|
CSRF_COOKIE_SECURE=
|
|
|
|
|
SECURE_SSL_REDIRECT=False
|
|
|
|
|
SESSION_COOKIE_SECURE=False
|
|
|
|
|
CSRF_COOKIE_SECURE=False
|
|
|
|
|
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:
|
|
|
|
|
DJANGO_SETTINGS_MODULE=main_project.dev_settings python manage.py runserver
|
|
|
|
|
- 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`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- 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:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|