Code for the Clyde Mountaineering Club site lives here. Frontend is written in React, and the backend is Django.
- Install the Python package manager poetry on your machine
cd
into the mountains directory (the back end project)- Run
poetry install
to install python packages - Run database migrations to ensure the database is up to date with
poetry run python manage.py migrate
- Run the command
poetry run python manage.py runserver
to start the server locally
- Install sqlite 3 and add it to your PATH environment variable
cd
into the mountains directory and run 'poetry run python manage.py dbshell`
- Install nodeJs and the bundled npm package manager on your machine
cd
into the frontend directory- Run
npm install
to install all packages - Run
npm start
to run locally
To deploy the frontend, go to the frontend directory and
npm run build
scp -r build*/ <ssh host>:/var/www/html
This is deployed via gunicorn, which is serving django out of the downloaded git repository.
As such, if I want to update to a new version, it should be as simple as
- Use git to pull in the new version of the repo.
- Use poetry if needed to update any dependencies.
- Do any migrations (ensuring
DJANGO_APP_STAGE=prod
when running commands). - Restart gunicorn and the socket (
systemctl restart gunicorn gunicorn.socket
).