In Part 1 of this tutorial, we deployed the Ephany Framework onto an $8 DigitalOcean Droplet, configured our settings files, created a virtual environment, and verified the app worked using Django’s development server.
Now it’s time to take the next step:
Turning your Ephany Framework instance into a real server-side service using Gunicorn and Nginx.
This guide continues the beginner-friendly approach. Even if you’re new to Linux, Django, or deployment, we’ll keep it simple, step-by-step, and specific to the Ephany Framework’s project structure:
ephany_framework/
settings/
base.py
dev.py ← created on the server
Let’s continue where we left off.
1. Install and Test Gunicorn
Gunicorn is a Python WSGI server that runs Django in production-like environments.
First, activate your virtual environment:
cd ~/app source venv/bin/activate
Install Gunicorn:
pip install gunicorn
Now test it:
gunicorn ephany_framework.wsgi:application --bind 0.0.0.0:8000
Visit:
http://YOUR_SERVER_IP:8000
If the app loads, congratulations — Gunicorn can run the Ephany Framework.
Note: The admin theme will not load at this step. In other words, although Ephany Framework is running, the web page will look like Cragislist in 1999.
Press Ctrl+C to stop the server.
2. Ensure Django Uses the dev.py Settings File
System services (like systemd) do not read your ~/.bashrc.
They also do not set DJANGO_SETTINGS_MODULE automatically.
That’s why we add this line to your .env file:
nano /home/deploy/app/.env
Add or confirm this line exists:
DJANGO_SETTINGS_MODULE=ephany_framework.settings.dev
This guarantees that whenever Gunicorn starts, Django loads your dev.py settings — including your ALLOWED_HOSTS configuration.
Your .env should now resemble:
DJANGO_SETTINGS_MODULE=ephany_framework.settings.dev DJANGO_SECRET_KEY=your-production-secret-key DJANGO_DEBUG=False DJANGO_ALLOWED_HOSTS=YOUR_SERVER_IP 127.0.0.1 localhost
3. Create a Gunicorn Systemd Service
Systemd lets your app:
- run automatically in the background
- restart on failure
- start on server boot
Create the service file:
sudo nano /etc/systemd/system/ephany-gunicorn.service
Paste the following, but update as needed per your username and Ephany-Framework folder path. Keep in mind that in the paths below, deploy is the username in which you installed Ephany Framework and Ephany-Framework is the folder that was cloned from GitHub.
[Unit] Description=Gunicorn service for the Ephany Framework After=network.target [Service] User=deploy Group=www-data WorkingDirectory=/home/deploy/Ephany-Framework EnvironmentFile=/home/deploy/Ephany-Framework/.env Environment="PATH=/home/deploy/Ephany-Framework/venv/bin" ExecStart=/home/deploy/Ephany-Framework/venv/bin/gunicorn ephany_framework.wsgi:application --bind 127.0.0.1:8000 Restart=on-failure [Install] WantedBy=multi-user.target
Save and exit.
Now activate it:
sudo systemctl daemon-reload sudo systemctl enable ephany-gunicorn sudo systemctl start ephany-gunicorn sudo systemctl status ephany-gunicorn
If you see:
active (running)
…then the Ephany Framework is now running as a background service.
4. Install and Configure Nginx
Gunicorn runs Django, but it’s not meant to serve public web traffic directly.
This is where Nginx comes in — it sits in front of Gunicorn and handles:
- web requests
- static file delivery
- reverse proxying to port 8000
Create an Nginx site config:
sudo nano /etc/nginx/sites-available/ephany
Paste:
server {
listen 80;
server_name YOUR_SERVER_IP;
location /static/ {
alias /home/deploy/Ephany-Framework/staticfiles/;
}
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Enable the site:
sudo ln -s /etc/nginx/sites-available/ephany /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl restart nginx
Now visit:
http://YOUR_SERVER_IP
You should see the live Ephany Framework served by Nginx → Gunicorn → Django.
5. Final Step: Create a Superuser
You may have already done this step in Part One, but we will repeat it here just in case.
To access Ephany Admin on your live server, ensure you have the main admin account created:
cd ~/app source venv/bin/activate python manage.py createsuperuser
Provide:
- Username
- Password
Then open:
http://YOUR_SERVER_IP/admin
Log in with your new superuser account — the admin theme should appear correctly, with static files served by Nginx.
Congratulations! You Now Have Ephany Framework Running Autonomously
At this point, your Ephany Framework dev server:
- Runs under systemd (automatic restarts + background execution)
- Receives web traffic through Nginx
- Loads server-specific settings from
ephany_framework/settings/dev.py - Uses environment variables from
.env - Serves static files properly
- Supports Ephany Admin via a superuser
- Runs on a modern, clean Ubuntu Droplet for just $8/month
This completes the beginner-friendly deployment path.
Bonus: Pointing Ephany Framework to a Subdomain
If you want your Ephany Framework installation to be accessible at a subdomain like:
open.yourdomain.com
all you need to do is create an A record that points your subdomain to your server’s public IP address.
1. Create an A Record for Your Subdomain
In your DNS provider’s control panel (cPanel, Cloudflare, Namecheap, Google Domains, etc.):
- Type: A
- Name:
open(or whatever subdomain you want) - Value: your server’s IP address
- TTL: leave default
Once saved, DNS changes may take a few minutes to propagate.
2. Add the Subdomain to Django’s ALLOWED_HOSTS
On your server, edit the dev.py settings file:
cd ~/Ephany-Framework/ephany_framework/settings nano dev.py
Add your subdomain:
ALLOWED_HOSTS = [
"open.yourdomain.com",
"yourdomain.com",
YOUR IP ADDRESS,
"127.0.0.1",
"localhost",
]
Save and exit.
3. Restart Gunicorn to Apply Changes
Anytime you update Django settings, restart your Gunicorn system service:
sudo systemctl restart ephany-gunicorn
Optional, but wouldn’t hurt to run:
sudo systemctl restart nginx
4. Test Your Subdomain
Once DNS has propagated, open your browser and visit:
http://open.yourdomain.com
You should now see your Django/Ephany Framework app served under the new subdomain.
Bonus #2: Enabling HTTPS by installing an SSL Certificate
Now that your Django server is live and running under a subdomain, the final step to have a legitimate web app is to secure it with HTTPS. Browsers expect it, search engines prefer it, and modern APIs often require it.
The easiest (and completely free) way to add HTTPS is by using Let’s Encrypt with a tool called Certbot.
This section will walk you through installing Certbot, generating an SSL certificate, and updating Nginx so your site is automatically served over HTTPS.
1. Install Certbot and the Nginx Plugin
SSH into your server and run:
sudo apt update sudo apt install -y certbot python3-certbot-nginx
This installs Certbot plus the Nginx integration, which makes the setup almost automatic.
2. Run Certbot to Enable HTTPS
Simply run:
sudo certbot --nginx
Certbot will:
- Detect your existing Nginx site configuration
- Ask which domain/subdomain you want to secure
- Automatically request a certificate
- Update your Nginx config
- Install a redirect from HTTP → HTTPS (optional but recommended)
When prompted:
- Select your domain(s), e.g.:
open.yourdomain.comyourdomain.com
- Choose redirect all traffic to HTTPS when asked
That’s it — Certbot rewrites your Nginx config with the proper SSL settings.
3. Verify HTTPS Is Working
Open your browser and visit:
https://open.yourdomain.com
You should see:
- A padlock icon in the URL bar
- Your Django/Ephany installation loading securely
If you still see the unsecure version, try:
- A hard refresh (
CTRL+SHIFT+RorCMD+SHIFT+R) - Using an incognito window
- Waiting a couple minutes for your browser to update DNS/SSL cache
Note: Certbot Handles Automatic Renewal
Let’s Encrypt certificates last 90 days, but Certbot installs an automatic renewal job for you.
You can test the renewal process with:
sudo certbot renew --dry-run
If no errors appear, your SSL certificate will always renew itself.
4. Make Sure ALLOWED_HOSTS Includes the HTTPS Domain
HTTPS doesn’t change your hostnames, but it’s worth confirming the domain is included in your server settings:
ALLOWED_HOSTS = [
"open.yourdomain.com",
"yourdomain.com",
"64.225.42.51",
"127.0.0.1",
"localhost",
]
If you make any updates:
sudo systemctl restart ephany-gunicorn sudo systemctl restart nginx
That’s It! Your Ephany Framework Instance Is Running and is Fully Secure
You now have:
- A live Django server
- Running under Gunicorn + Nginx
- Served through HTTPS
- Protected by a valid SSL certificate
- Automatically renewing via Certbot
This is the same setup used by production Django applications, but simplified for your development server.
Troubleshooting
Admin Page Still Isn’t Styled? Check Nginx Permissions
If your Django admin page is still unstyled after running collectstatic, don’t worry — this is a common issue for first-time deployments.
Even when your static files are in the right folder, Nginx may not be allowed to read them. Because Nginx runs as the www-data user, it needs permission to access both:
- the
staticfiles/directory - the files inside it
- and the parent folders leading to it
You can fix this by updating the permissions on your static files:
sudo chown -R deploy:www-data /home/deploy/Ephany-Framework/staticfiles
sudo find /home/deploy/Ephany-Framework/staticfiles -type d -exec chmod 755 {} \;
sudo find /home/deploy/Ephany-Framework/staticfiles -type f -exec chmod 644 {} \;
Then make sure the parent folders are also accessible:
ls -ld /home /home/deploy /home/deploy/Ephany-Framework
If any of them are not drwxr-xr-x, fix them with:
sudo chmod 755 /home/deploy sudo chmod 755 /home/deploy/Ephany-Framework
After that, refresh:
http://YOUR_SERVER_IP/admin
Your admin styling should now load correctly.

Leave a Reply