Website Link: www.blindzonesafety.org
- Create a virtual environment using the command below.
python -m venv /path/to/environment_name
- Activate virtual environment. Navigate to directory where enviroment is located.
source environment_name/bin/activate
-
Clone this repository and deploy the main branch.
-
Navigate into the repository project folder.
-
In terminal, run the line of code below to install all necessary packages. Make sure you are in your virtual environment.
pip install -r requirements.txt
-
Create a file called .env and place in root directory of project folder. Copy in secret environment variables and add to .gitignore if not already there. For security, this file should never be committed or pushed to GitHub.
-
Add your device IP address to the Digital Ocean database trusted sources.
a. Log in to Digital Ocean using sign in with gmail.
b. On the left side panel, click on Databases.
c. Click on the database called db-postgresql-nyc3-27521.
d. Click on the Settings tab, scroll down to Trusted Sources, and click Edit.
e. Enter your device IP address and click Save. Typically, once you click into the input field, your IP address will show up automatically as a suggested IP.
- To launch the local server, run the line below in the root directory of the project.
python manage.py runserver
When editing any static files, such as javascript files (.js) or CSS files (.css), your changes will not automatically show up on the local site or on the production site. Run the command below to push changes to the website storage on Digital Ocean where static files are stored. This must be done whether making changes to the local or production site.
python manage.py collectstatic --noinput
Changes made to the other files will be updated on the locally run website immediately upon refreshing. However, when ready to make changes to the production website, changes must be committed then pushed to the branch that the production website is sourcing (right now it is the main branch). After changes are pushed, Digital Ocean rebuilds and deploys the site, which can take anywhere from 4-8 minutes.
Navigate to the command line and type in the following command, replacing the
sections in <>
with the correct values.
psql -h <REMOTE HOST> -p <REMOTE PORT> -U <DB_USER> <DB_NAME>