How do I deploy my Django project?
- In the panel, open My servers and click your server.
- On the Overview tab, wait for the App row to say "Django is ready". The page refreshes itself.
- Open the link in the Admin address row and enter the details from the Login and Password rows.
Working on the project
Connect over SSH and run:
su - app
cd ~/proje
set -a; . /etc/seturack-django.env; set +a
The last line loads the production settings. After that, venv/bin/python manage.py migrate and venv/bin/python manage.py collectstatic work. Use venv/bin/pip install to add packages. When your code changes, run systemctl restart uygulama as root.
Files
- Production settings:
~/proje/proje/uretim.py - Secret values:
/etc/seturack-django.env - The database name and user are both
django, on host127.0.0.1. PostgreSQL is not open to the outside.
Your own domain
- Point your domain's A record to your server's IP address.
- As root, replace the old name everywhere:
sed -i 's/OLD_NAME/yourdomain.com/g' /etc/caddy/Caddyfile.OLD_NAMEis the part afterhttps://in the address shown in the panel. - Run
systemctl reload caddy.
Caddy gets and renews the certificate by itself.
Also write your domain into DJANGO_ALAN and DJANGO_ADRES in /etc/seturack-django.env. Only 80, 443 and 22 for SSH are open to the outside.
No server yet? Order a server with Django installed: you choose the size and pay for what you choose.
Thanks for your feedback!