This is a simple backend service project to manage customer orders.
Authentication via OAuth2
-
Create user on Google OAuth2 playground
-
Under step one (select and authorize API):
- Choose Google OAuth2 API V2
- Define the scopes below
- Click authorize API
-
You will have to login with a gmail account
-
Sign in to Google OAuth 2.0 playground
-
Click on the blue Exchange authorization code for the tokens button. This will generate a google generated access token that will then be needed to be converted by DRF in order to create the authorization and authentication Bearer token needed for this app.
-
Create a customer instance
-
Create an order instance NB Africa’s Talking API sandbox was out at the time of this release.
- Twilio only sends messages to verified account thereby with the current implementation you won't receive an order confirmation SMS
- Python3 (version 3.12.1)
- Pipenv (version 2023.11.12)
- Django (version => 5.0.1)
- PostgreSQL
- Clone this repository
git clone https://github.com/kimperria/alertify.git
- Navigate into the project base folder
cd alertify
- Open the root folder with and IDE. See example below for VSCode
code .
- Create and activate a virtual enviroment,
pipenv shell
- Install project dependacies
pipenv install
- Create .env files .env
- Create a postgres database.
SECRET_KEY='django-secret-key' or 'you-will-never-guess'
DJANGO_ENV='dev' // default for development
DEBUG=True
DATABASE_URL=postgres://{{DATABASE_USER}}:{{DATABASE_PASSWORD}}@localhost:5432/{{ DATABASE_NAME}}'
DB_NAME='blackpanther22'
DB_USER='postgres user' or 'allowed psql user'
DB_PASSWORD='you-will-never-guess'
ALLOWED_HOSTS=provide for localhost (Should be a list)
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY='some value from your OAuth config'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET='some value from your OAuth config'
TWILIO_ACCOUNT_SID='some value from Twilio config'
TWILIO_AUTH_TOKEN='some value from Twilio config'
TWILLIO_PHONE_NUMBER='some value from Twilio config'
Update the value of ENV var according to your local setup
- Migrations
This command is optional as there should be no pending migrations
python manage.py makemigrations
- Register models and fields to local database
python manage.py migrate
- Create the django super user
python manage.py createsuperuser
Follow and fill in the prompts
- Fire up the server
python manage.py runserver
The development server should listen on port:8000
Visit admin interface on: localhost/admin
This project is designed, developed and maintained by: Kimani John
Database schema: Alertify ERD Design thinking documentation: Alertify Doc
Spot a bug or ppen issues == True?
- View open issues
- kindly review the playbook.md for version control workflows.
- Folk then clone this repository to your local develop setup.
- Build your feature then raise PR to match the current develop branch. In certain cases, please write unit tests and validated them to pass.
- Request approval and assign project author to review your PR.
Please review installed linters black, flake8, isort, precommit for code formating and guidelines