title: django cannot access default admin section
body: <p>I am trying to access the django default admin section and I get a </p>
  
  <pre><code>404 error "not found"
  </code></pre>
  
  <p>I can access the default django splash page that tells me I am in debugging mode</p>
  
  <p>If I try to access via nginx, I get a nginx bases 404 error 'not found' in browser.</p>
  
  <pre><code>(secret) kermit@tuna:~/www/src/exchange $ cat /etc/nginx/sites-available/default 
  upstream django {
          server unix:///var/run/uwsgi/exchange.sock; # for a file socket
          #server 127.0.0.1:8001; # for a web port socket (we'll use this first)
  }
  
  
  # Default server configuration
  #
  server {
          access_log /var/log/nginx/access.log;
          error_log /var/log/nginx/error.log;
          listen 80 default_server;
          listen [::]:80 default_server;
  
          # SSL configuration
          #
          listen 443 ssl default_server;
          listen [::]:443 ssl default_server;
          root /home/kermit/www/src/exchange;
          index index.html index.htm index.php index.nginx-debian.html;
  
          server_name tuna.tra.com;
  
          location / {
                  try_files $uri $uri/ =404;
                  include     /etc/nginx/uwsgi_params;
          }
  
          # pass PHP scripts to FastCGI server
          #
          location ~ \.php$ {
                  include snippets/fastcgi-php.conf;
          }
  
          # Django media
          location /media  {
                  alias /home/kermit/www/src/exchange/media;  # your Django project's media files - amend as required
          }
  
          location /static {
                  alias /home/kermit/www/src/exchange/static; # your Django project's static files - amend as required
          }
  
          # Finally, send all non-media requests to the Django server.
          #location / {
          #        uwsgi_pass  django;
          #        include     /etc/nginx/uwsgi_params; # the uwsgi_params file you installed
          #}
  }
  </code></pre>
  
  <p>(secret) kermit@tuna:~/www/src/exchange $ cat exchange/urls.py </p>
  
  <pre><code>from django.contrib import admin
  from django.urls import path
  
  urlpatterns = [
      path('admin/', admin.site.urls),
  ]
  </code></pre>
  
  <p>(secret) kermit@tuna:~/www/src/exchange $ cat exchange/settings.py    </p>
  
  <pre><code>import os
  BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  SECRET_KEY = 'snicker'
  DEBUG = True
  ALLOWED_HOSTS = ['192.168.42.13','localhost']
  # Application definition
  INSTALLED_APPS = [
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
  
      #mystuff
      'userdash',
  #    'userdash.apps.UserdashConfig',
  ]
  
  MIDDLEWARE = [
      'django.middleware.security.SecurityMiddleware',
      'django.contrib.sessions.middleware.SessionMiddleware',
      'django.middleware.common.CommonMiddleware',
      'django.middleware.csrf.CsrfViewMiddleware',
      'django.contrib.auth.middleware.AuthenticationMiddleware',
      'django.contrib.messages.middleware.MessageMiddleware',
      'django.middleware.clickjacking.XFrameOptionsMiddleware',
  ]
  
  ROOT_URLCONF = 'exchange.urls'
  
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [],
          'APP_DIRS': True,
          'OPTIONS': {
              'context_processors': [
                  'django.template.context_processors.debug',
                  'django.template.context_processors.request',
                  'django.contrib.auth.context_processors.auth',
                  'django.contrib.messages.context_processors.messages',
              ],
          },
      },
  ]
  
  WSGI_APPLICATION = 'exchange.wsgi.application'
  
  
  # Database
  # https://docs.djangoproject.com/en/2.2/ref/settings/#databases
  
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.sqlite3',
          'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
      }
  }
  
  
  # Password validation
  # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
  
  AUTH_PASSWORD_VALIDATORS = [
      {
          'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
      },
      {
          'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
      },
      {
          'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
      },
      {
          'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
      },
  ]
  
  LANGUAGE_CODE = 'en-us'
  TIME_ZONE = 'UTC'
  USE_I18N = True
  USE_L10N = True
  USE_TZ = True
  # Static files (CSS, JavaScript, Images)
  # https://docs.djangoproject.com/en/2.2/howto/static-files/
  STATIC_URL = '/static/'
  STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
  
  
  
  
  
  
  (secret) kermit@tuna:~/www/src/exchange $ cat userdash/models.py 
  #be sure to run makemigrations and migrate after editing this file
  from django.db import models
  
  # Create your models here.
  
  class Product(models.Model):
          title           = models.TextField()
          describtion     = models.TextField()
          price           = models.TextField()
          summary         = models.TextField(default='Bite me wanker!')
  </code></pre>
  
  <p>How do I access the default django admin section?</p>
  
  <p>UPDATE:</p>
  
  <p>If I run the django server using</p>
  
  <pre><code>python3 manage.py runserver 8181
  </code></pre>
  
  <p>and then try from command line with </p>
  
  <pre><code>links http://127.0.0.1:8181/admin/
  </code></pre>
  
  <p>I can connect to admin folder just fine. So my issue appears nginx specific and not Django.</p>
  
  <p>UPDATE:</p>
  
  <p>same effect if I browse using the trailing slash</p>
  
  <pre><code>http://127.0.0.1/admin/
  </code></pre>
  
  <p>and also using the default django webserver </p>
  
  <pre><code>python3 manage.py runserver 0.0.0.0:8000
  </code></pre>
  
  <p>UPDATE:</p>
  
  <p>I was able to fish this error out of logs finally.</p>
  
  <pre><code>2020/03/28 19:38:20 [error] 28811#28811: *22 open() "/home/kermit/www/src/exchange/static/admin/css/fonts.css" failed (13: Permission denied), client: 127.0.0.1, server: tuna.tra.com, request: "GET /static/admin/css/fonts.css HTTP/1.1", host: "fatchalkrvfzviql.com", referrer: "http://fatchalkrvfzviql.com/"
  </code></pre>
  
  <p>I tried </p>
  
  <pre><code>chown -R www-data:www-data /home/kermit/www/src/exchange/static/
  
  chown -R kermit:kermit /home/kermit/www/src/exchange/static/
  </code></pre>
  
  <p>made sure dir were chmod 700 and files 600</p>
  
  <p>nothing</p>