Webapp that integrates with Twitch for dynamic username colours
This was my first project to use Vue.js or Django (or celery, or a relational database), so I apologise for it possibly being an incoherent mess in places. Previously I relied on JQuery and Flask for my webapps, and my largest Flask project was pretty much just spaghetti code.
I currently have this deployed at colours.zaxu.xyz
- Node and Python 3.6+ need to be installed on the system. It's also recommended to use a virtual environment for Python (
python -m venv venv) - Dependencies for the frontend app should be installed with
npm installin thevueappsubdirectory - Dependencies for the backend should be installed with
pip install -r requirements.txtin thebackendssubdirectory
The backend django server requires an additional settings file that imports * from settings.py in order to function. - e.g. local_settings.py or prod_settings.py This settings file is used by django by passing --settings=<settings module> to manage.py
- The backend relies on
celerywithredis, so for all endpoints to workredis-serverand aceleryworker must be running on the server. Theceleryworker is started withcelery -A colours worker -l info --autoscale=100,1(autoscale parameter can be adjusted depending on the expected load)
- Run Vue frontend app with
npm run serveinvueapp - Run Django backend with
python manage.py runserver --settings=colours.local_settings(or wherever else your settings are stored)
The Vue app by default proxies /api/ to localhost:8000. If you're running the Django backend on a port other than 8000, you will have to modify the target value for ^/api under devServer.proxy in vueapp/vue.config.js
- An optimised version of the Vue app should be built with
npm run buildinvueappand thedistcontents placed wherever your files are being served - For deploying the backend, see Django's documentation on it.