- Clone the project from https://github.com/Planning-Visualisation/planning-visualisation
- Install python version 3.6 from https://www.python.org/downloads/release/python-360/
- Navigate to /backend/server
- install python dependencies:
pip install -r requirements.txt - Finally, run the server:
python manage.py runserver
- Install docker from https://www.docker.com/ if you don't have it on your local machine
##Setting required env's
- Rename env.sample (inside backend/docker/) to .env
- Change the value of BACKEND_SOURCE pointing to the right path in your local system
- Navigate to backend/docker/ and run the command
docker-compose upon your terminal - Test if the web server is running in the docker using the command
docker psor alternatively visitlocalhost:8000in the browser.
After installing heroku, first login with your heroku account in terminal/console:
heroku login
then create an empty heroku project:
heroku create
Heroku will create random name directory for the project
cd [project_name]
and set the buildpack environment for python:
heroku buildpacks:set heroku/python
at last, move your django files to this directory
Now the project is setup, the next step is deploying it to heroku. We need to have two documents:
requirements.txtProcfile(no .extend)
requirments.txt is telling heroku what should be installed for the deployment server, it can simply generated by calling pip freeze > requirements.txt
we need to have two extra package for our project to run, adding the following lines in requirments.txt:
django-cors-headers==2.4.0
gunicorn==19.7.1
Procfile is telling what the deployment server will automatlly run:
web: gunicorn [servername].wsgi --log-file -
the [servername] is the name of the django project, it is named server in our project.
Heroku is using git to publish, so next, we will need to add all our change in the heroku project and commit them.
git add *
git commit -m "deploy project"
then we will push to heroku master branch:
git push heroku master