A basic web app to showcase django deployment with caprover
License: | MIT |
---|
Moved to settings.
To create a normal user account, just go to Sign Up and fill out the form. Once you submit it, you'll see a "Verify Your E-mail Address" page. Go to your console to see a simulated email verification message. Copy the link into your browser. Now the user's email should be verified and ready to go.
To create an superuser account, use this command:
$ python manage.py createsuperuser
For convenience, you can keep your normal user logged in on Chrome and your superuser logged in on Firefox (or similar), so that you can see how the site behaves for both kinds of users.
Running type checks with mypy:
$ mypy caproverdj
To run the tests, check your test coverage, and generate an HTML coverage report:
$ coverage run -m pytest $ coverage html $ open htmlcov/index.html
$ pytest
Moved to Live reloading and SASS compilation.
The following details how to deploy this application.
During the setup we will refer to the django app as demo-django, the redis app as demo-redis and the prostgre app as demo-db.You may change this names to your liking
The following assumptions are made about your environment: - You have a working CapRover - You have read and understood the basic CapRover documentation - You have ssh access to you CapRover server - You have configure a gmail app
Create a postgres app from the one-click wizard
Choose demo for the name as this will automatically be prefixed with -db
Note username, database and password
same process for the redis app but only fill the name form
Create a new blank app with the name demo-django
In the App Configs tab, toggle the bulk edit for environment variables and then paste the section below. Fill in the values in bracket. The app name is the name provided by caprover, it usually starts with srv-.
DJANGO_DEBUG=False DJANGO_SECRET_KEY=YOUR_SECRET_KEY DJANGO_SETTINGS_MODULE=config.settings.production DJANGO_ADMIN_URL=A_RANDOM_LONG_URL DJANGO_ALLOWED_HOSTS=YOUR_APP_DOMAIN_NAME DATABASE_URL=postgresql://{postgres_user}:{postgres_pass}@{postgres_app_name}:5432/{postgres_db_name} REDIS_URL=redis://:{redis_password}@{redis_app_name}:6379 EMAIL_HOST_USER=YOUR_GMAIL_APP_USER EMAIL_HOST_PASSWORD=YOUR_GMAIL_APP_PASSWORD
Deploy the code from this repository with your method of choice to demo-django
Open a ssh session to demo-django by typping
docker exec -it $(docker ps --filter name=your_demo_app_name -q) /bin/sh
Create a superuser by executing python manage.py createsuperuser
This caprover setup is based on: https://gitlab.com/kamneros/caprover-django