Compare commits

..

No commits in common. "b94ecf0fd5ce23733e3e8ba70a9021a687dc42c4" and "5ce795ce14c1d96b397732a27e626188160bd201" have entirely different histories.

3 changed files with 19 additions and 29 deletions

View File

@ -1,7 +1,7 @@
# Selah Django backend API # Selah Django backend API
*** LOCAL DJANGO ENVIRONMENT SETUP (installing libraries/dependencies) *** *** DJANGO ENVIRONMENT LOCAL 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,9 +67,10 @@ 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 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` *** 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)
- in the `main_project` directory, create a new `.env` file with the following environmnt variables. Get actual values from me: - 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:
``` ```
DEV_MODE= DEV_MODE=
DOMAIN= DOMAIN=
@ -81,41 +82,34 @@ EMAIL_PORT=
EMAIL_HOST_USER= EMAIL_HOST_USER=
EMAIL_HOST_PASSWORD= EMAIL_HOST_PASSWORD=
SECRET_KEY= SECRET_KEY=
DBENGINE=django.db.backends.postgresql DBENGINE=
DBNAME=selah_dev_db DBNAME=
DBUSER=<YOUR LOCAL POSTGRES USER> DBUSER=
DBPASSWORD=<YOUR LOCAL POSTGRES PASSWORD> DBPASSWORD=
DBHOST=127.0.0.1 DBHOST=
STRIPE_DOMAIN= STRIPE_DOMAIN=
STRIPEPK= STRIPEPK=
STRIPESK= STRIPESK=
STRIPE_WEBHOOK_SECRET= STRIPE_WEBHOOK_SECRET=
SECURE_SSL_REDIRECT=False SECURE_SSL_REDIRECT=
SESSION_COOKIE_SECURE=False SESSION_COOKIE_SECURE=
CSRF_COOKIE_SECURE=False CSRF_COOKIE_SECURE=
ADMIN_URL= ADMIN_URL=
``` ```
set backend env DEV_MODE var:
- make sure env is activated and set backend env DEV_MODE var: DEV_MODE=True
`DEV_MODE=True`
- cd to `/backned` directory where the `manage.py` file is and start Django dev server in terminal: - 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/api/selah` 127.0.0.1:8000
- 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:
``` ```

View File

@ -11,7 +11,7 @@ environ.Env.read_env()
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
# set to False for production # set to False for production
DEBUG = env('DEV_MODE') DEBUG = True
# SECURE_SSL_REDIRECT=True # SECURE_SSL_REDIRECT=True
# SESSION_COOKIE_SECURE=True # SESSION_COOKIE_SECURE=True

View File

@ -16,7 +16,3 @@ urlpatterns = [
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
admin.site.site_header = 'Selah'
admin.site.index_title = 'Selah Administration'
admin.site.site_title = 'Selah'