The most amazing SaaS application the world has ever seen
The easiest way to get up and running is with Docker.
Just install Docker and Docker Compose and then run:
make init
This will spin up a database, web worker, celery worker, and Redis broker and run your migrations.
You can then go to localhost:8000 to view the app.
Note: if you get an error, make sure you have a .env.docker
file, or create one based on .env.example
.
You can run make
to see other helper functions, and you can view the source
of the file in case you need to run any specific commands.
For example, you can run management commands in containers using the same method
used in the Makefile
. E.g.
docker compose exec web python manage.py createsuperuser
You can also install/run the app directly on your OS using the instructions below.
Setup a virtualenv and install requirements (this example uses virtualenvwrapper):
mkvirtualenv smart_review -p python3.11
pip install -r dev-requirements.txt
If you are using Docker you can skip these steps.
Create a database named smart_review
.
createdb smart_review
Create database migrations:
./manage.py makemigrations
Create database tables:
./manage.py migrate
Docker:
make start
Native:
./manage.py runserver
To build JavaScript and CSS files, first install npm packages:
Docker:
make npm-install
Native:
npm install
Then build (and watch for changes locally):
Docker:
make npm-watch
Native:
npm run dev-watch
Celery can be used to run background tasks. If you use Docker it will start automatically.
You can run it using:
celery -A smart_review worker -l INFO
Or with celery beat (for scheduled tasks):
celery -A smart_review worker -l INFO -B
Docker:
make translations
Native:
./manage.py makemessages --all --ignore node_modules --ignore venv
./manage.py makemessages -d djangojs --all --ignore node_modules --ignore venv
./manage.py compilemessages
To setup Google Authentication, follow the instructions here.
To setup Twitter Authentication, follow the instructions here.
To setup Github Authentication, follow the instructions here.
To install the Git commit hooks run the following:
$ pre-commit install --install-hooks
Once these are installed they will be run on every commit.
For more information see the docs.
To run tests:
Docker:
make test
Native:
./manage.py test
Or to test a specific app/module:
Docker:
docker compose exec web python manage.py test apps.utils.tests.test_slugs
Native:
./manage.py test apps.utils.tests.test_slugs
On Linux-based systems you can watch for changes using the following:
Docker:
find . -name '*.py' | entr docker compose exec web python manage.py test apps.utils.tests.test_slugs
Native:
find . -name '*.py' | entr python ./manage.py test apps.utils.tests.test_slugs