# How do I deploy my Django project?

https://www.seturack.com/en/knowledgebase/article/how-do-i-deploy-my-django-project

1. In the panel, open **My servers** and click your server.
2. On the **Overview** tab, wait for the **App** row to say "Django is ready". The page refreshes itself.
3. 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](https://www.seturack.com/en/knowledgebase/article/how-to-connect-with-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 host `127.0.0.1`. PostgreSQL is not open to the outside.

## Your own domain

1. Point your domain's A record to your server's IP address.
2. As root, replace the old name everywhere: `sed -i 's/OLD_NAME/yourdomain.com/g' /etc/caddy/Caddyfile`. `OLD_NAME` is the part after `https://` in the address shown in the panel.
3. 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](https://www.seturack.com/en/django-vps): you choose the size and pay for what you choose.
