Skip to content

Latest commit

 

History

History
83 lines (59 loc) · 3.53 KB

README.md

File metadata and controls

83 lines (59 loc) · 3.53 KB

teesco-backend

Branches

The repository has the following primary branches:

  • master - This contains the code which has been released (production ready code).
  • develop - This contains the latest code. All the contributing PRs must be sent to this branch.

Setup and run

  1. Create a virtual environment with Python3.7: virtualenv env -p python3.7. If you dont have python3.7 yet then you can install it with:
    1. linux(ubuntu/debian) - sudo apt install python3.7
    2. windows - Download installer from https://www.python.org/downloads/release/python-370/.
  2. Activate the virutal environment: source env/bin/activate
  3. Install all the dependencies in requirements.txt file: pip install -r requirements.txt
  4. Make a copy of .env.sample to .env and change the values of variables with original values. Click here for sample .env file.
  5. See below for celery setup.
  6. See below for email setup.
  7. Migrate the migrations: python manage.py migrate
  8. Run the app: python manage.py runserver
  9. Navigate to http://localhost:8000 in your browser
  10. When you are done using the app, deactivate the virtual environment: deactivate

Example env file

SECRET_KEY=''3izb^ryglj(bvrjb2_y1fZvcnbky#358_l6-nn#i8fkug4mmz!''
ALLOWED_HOSTS='*'
DEBUG='True'
EMAIL_HOST_USER='username@gmail.com'
EMAIL_HOST_PASSWORD='password'
MOCK_EMAIL = <True-or-False>
EMAIL_SERVICE = '<DJANGO-SMTP or AWS-SES>'
AWS_REGION_NAME = 'AWS_REGION_NAME'
EMAIL_HOST= 'smtp.gmail.com'
AWS_ACCESS_KEY_ID = 'AWS_ACCESS_KEY_ID'
AWS_SECRET_ACCESS_KEY = 'AWS_SECRET_ACCESS_KEY'

note:

  1. MOCK_EMAIL defaults to True

Email Setup

For gmail:

  1. Set the EMAIL_SERVICE to 'DJANGO-SMTP'
  2. If your are using gmail then normal password is not enough to send email through django email package. You have to enable two step verification in https://myaccount.google.com/security.
  3. Then generate a new app password for teesco.
  4. The app password will look like this.
  5. This 16 letter code should be set to EMAIL_HOST_PASSWORD in .env.
  6. We have added below images for help.

For Amazon SES

  1. Set the EMAIL_BACKEND to 'AWS-SES' in .env
  2. Also set the AWS_SECRET_ACCESS_KEY,AWS_REGION_NAME and AWS_ACCESS_KEY_ID in .env.

Other than gmail: Other email providers like outlook, hotmail, rediffmail, yahoo mail etc., should work with normal email password. Else they will have a similar approach.

Celery Setup

For linux

  1. sudo apt install redis-server
  2. In a separate terminal run celery -A server worker -l info when the celery command is needed.
  3. If you see the below image celery is running successfully in your system. image

For windows

  1. Even though redis can be installed in windows but the celery(a python package needed in this project) doesn't work on windows.
  2. Dont you worry we are exploring other alternatives for windows.
  3. Still you can contributions which dont require celery. Open two terminals and run on second terminal