If you have not installed python
already on your system, please follow this link to install the same.
Please follow the steps mentioned here for your operating system to install postgreSQL
in your system.
If you are using linux as your driver OS you may follow the below steps. PostgreSQL usually create a user
postgres
who can accesspsql
. So, we will try to accesspsql
with userpostgres
.
sudo -su postgres psql
It will promt you to enter your root password. And after putting the right password you shall get access to psql
.
CREATE DATABASE essenvia;
CREATE USER essenvia WITH ENCRYPTED PASSWORD 'essenvia';
GRANT ALL PRIVILEGES ON DATABASE essenvia TO essenvia;
Press
\q
followed byenter
to come out of terminal
You may follow these steps to install redis on your system. After installing it successfully, start the redis-server
.
python -m venv env
This will create a virtual enironment with the name env
in the project root.
source env/bin/activate
You might see (env)
in your terminal which states that the virtual environment is active. For example:
(env) kdpisda @ kuldeep-vostro ~/Projects/essenvia-task
pip install -r requirements.txt
If you changed anythig while we were preparing the database in PostgreSQL
you might want to update the respective value in the .env.temp
file. Rename the file to .env
.
Will now we have activated the virtual environment and have placed a
.env
file in the project root with the respective value. This step is required to run the server and the worker.
source .env && ./manage.py migrate
Since we rely on pdfkit
to generate PDF files. Please follow the steps mentioned here to install wkhtmltopdf
as well which is necessary for smooth functioning of the app.
source .env && ./manage.py createsuperuser
It will ask for username
, email
, password
in a prompt, fill all the details and press enter. Make sure to enter email as well. So that we can login with the same credentials.
source .env && ./manage.py migrate
This will run the server in port 8000
Make sure you have activated the virtual environment. So in order for the better execution of the app we need to run the worker at the same time but in different terminal. So ideally, you would want to run the above command in one terminal, and the below command in the other terminal with virtual environment activated.
source .env && celery -A essenvia worker -l info
In order to run the app, you must also have your React App Client
Clone the repository and follow the instructions specified in the README.md
file in the React App repository. Use the credentials defined while creating the admin user for the Django API.