Django - The requested resource was not found on this server

I’ve installed Django, Nginx, Gunicorn and was able to get the default Django page when I had DEBUG = True. However, now I Have DEBUG = False and the page displays: The requested resource was not found on this server. I have the following in my configuration:

abcproject –abcweb — — — – –static –templates –venv –app .env

The app is the Django application. I have setup all the files I had in development for the app. That is the app I want displayed as the main website. Within app, I have templates, views, models, etc.

I have a .env file with environment variables. Here is an excerpt of my within --abcweb

import os from django.core.wsgi import get_wsgi_application

os.environ.setdefault(‘DJANGO_SETTINGS_MODULE’, ‘abcweb.settings’)

application = get_wsgi_application()

Here is my nginx configuration:

server { server_name;

location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
    root /home/user/abcproject;

location / {
    include proxy_params;
    proxy_pass http://unix:/run/gunicorn.sock;        

listen 443 ssl; # managed by Certbot
#info managed by certbot -- removed for privacy

} server { if ($host = { return 301 https://$host$request_uri; } # managed by Certbot

if ($host = {
    return 301 https://$host$request_uri;
} # managed by Certbot

listen 80;
return 404; # managed by Certbot

And the following is my Gunicorn configuration:

[Unit] Description=gunicorn daemon Requires=gunicorn.socket

[Service] User=pyxis Group=www-data WorkingDirectory=/home/user/abcproject ExecStart=/home/user/abcproject/venv/bin/gunicorn
–access-logfile -
–workers 3
–bind unix:/run/gunicorn.sock


I tried running: gunicorn -b abcweb.wsgi:application

It runs with no errors, but still yields the page The requested resource was not found on this server.

Any ideas would be much appreciated.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

I solved by changing my path in abcweb urls to path('’, include('app.urls’)),

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.

© 2023 DigitalOcean, LLC.