Backend written in Django, with DjangoREST for APIs.
Frontend written in React, with Material-UI and Redux
Made for IMG IIT Roorkee Developers' Summer Project of 2020.
Open your terminal in a folder of your choice (where you would want to store your repository.) For example, if you want to clone this project in the Home (~) directory, enter the following command:
user@system:~$ git clone https://github.com/MihirSachdeva/pesticide-dev.git
Then move to the newly formed directory called pesticide-dev
user@system:~$ cd pesticide-dev
The file base_template.yml is the template file for all the required variables needed to run the Django backend. This includes fields such as language code and timezone of the app, secret key, client id and client secret given by Omniport OAuth Dashboard, email parameters, and database variables. More detail information of these keys have been given in a table below. The settings.py file will look for the values of these parameters in a file named base.yml
in the config directory.
Make a new file named base.yml
in the same config directory as base_template.yml and then copy the contents of the file base_template.yml into base.yml
. Then fill all the fields in base.yml
and hit save.
key | meaning |
---|---|
language_code | Language code of the app, eg. en-us , en-gb , etc. |
timezone | Time zone of the app, eg. Asia/Kolkata , etc. |
key | meaning |
---|---|
secret_key | Secret key required in settings.py (50 characters) |
client_id | Client ID you obtained from the Omniport Channel i dashboard |
client_secret | Client secret key you obtained from Omniport Channel i dashboard |
redirect_uri | One of the redirect URIs you have registered on the Omniport Channel i dashboard |
desired_state | Any string that you want the REDIRECT_URI to receive on success |
key | meaning |
---|---|
email_host | Your emailing service host (like Google's smtp.gmail.com ) |
email_port | Your emailing service port (like 587 ) |
email_host_user | Your emailing service email id |
email_host_password | Your emailing service account password |
email_use_tls | This tells Django what secure protocol should be used to connect to the email server |
key | meaning |
---|---|
host | Your database host |
port | Your database port |
user | Your database user's username |
password | Your database user's password |
name | Database name |
Install pipenv
Pipenv is a packaging tool for Python that solves some common problems associated with the typical workflow using pip, virtualenv/venv, and the good old requirements.txt. To install pipenv, enter the following in your terminal:
user@system:~/pesticide-dev$ pip3 install pipenv
Using pipenv, start a virtual environment, and then install all required Python packages from Pipfile:
user@system:~/pesticide-dev$ cd pesticide_backend
user@system:~/pesticide-dev/pesticide_backend$ pipenv shell
(pesticide_backend) user@system:~/pesticide-dev/pesticide_backend$ pipenv install
The (pesticide_backend)
in the command line indicates that our virtual environment pesticide_backend
is active. To deactivate it, simply type exit
in the command line.
First set up your preferred database. In settings.py, MySQL database has been set up. All required parameters like host, port, user, database and password will be taken from base.yml. After that, to set up the database on your local system:
(pesticide_backend) user@system:~/pesticide-dev/pesticide_backend$ cd src/
(pesticide_backend) user@system:~/pesticide-dev/pesticide_backend/src$ python3 manage.py makemigrations peticide_app
(pesticide_backend) user@system:~/pesticide-dev/pesticide_backend/src$ python3 manage.py migrate pesticide_app
(pesticide_backend) user@system:~/pesticide-dev/pesticide_backend/src$ python3 manage.py makemigrations
(pesticide_backend) user@system:~/pesticide-dev/pesticide_backend/src$ python3 manage.py migrate
We will use a channel layer that uses Redis as its backing store. You must have Docker installed in your system. To start a Redis server on port 6379, run the following command:
(pesticide_backend) user@system:~/pesticide-dev/pesticide_backend$ docker run -p 6379:6379 -d redis:5
user@system:~/pesticide-dev$ cd pesticide_frontend/src/
user@system:~/pesticide-dev/pesticide_frontend/src$ npm install --save
(pesticide_backend) user@system:~/pesticide-dev/pesticide_backend/src$ python3 manage.py runserver
user@system:~/pesticide-dev/pesticide_frontend$ npm start
Then head over to 127.0.0.1:3000 to start using the app!
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.