python v3.8.10, pip v20.0.2 , virtualenv v20.23.0, gmail account
- install pip and venv if needed:
sudo apt install python-pip python-venv
- Clone the repository:
git clone https://github.com/ariel-research/cap-backend - Write the command:
cd cap-backend - Create a Python virtual environment for your Django project:
python -m venv venv - Activate the virtual environment:
For Linux:source venv/bin/activate
For Windows:venv\Scripts\activate - Install Python dependencies for this project:
pip install -r requirements.txt - Create an .env file and customize the project's environment variables. You can see here an example.
Please ensure that you provide proper values for the
DJANGO_SECRET_KEY,EMAIL_HOST_USER, andEMAIL_HOST_PASSWORDvariables, and that your.gitignorefile includes the.envfile. - Create super user using:
python manage.py createsuperuser - To enable email functionality, you need to set up an email account and generate an app password.
Click here to set a password for a Gmail account. - Run Django development server:
- To run the project on the default address (localhost:8000):
- Start the Django development server using the following command:
python manage.py runserver - Open
http://localhost:8000/admin/in a web browser to view your application.
- Start the Django development server using the following command:
- To run the project on a different address:
- Start the Django development server using the following command:
python manage.py runserver <your-hostname>:<port-number> - Open
http://<your-hostname>:<port-number>/admin/in a web browser to view your application.
- Start the Django development server using the following command:
- To run the project on the default address (localhost:8000):
- Insert your super user information has been created for Django.
- Now you can examine the database.
- Optional: for running Django with Gunicorn (and React app with Nginx) follow this guide.