Admin login returns 405 Not Allowed

2016-09-04 Thread Peter Laudenslager
Hi All,

Having trouble moving my Django site into production.  I can hit pages for 
my application (no authentication required), and they all seem to work 
correctly.  When I connect to the default admin page, I see the correct 
login dialog box.  When I submit my credentials, I get a 405 Not Allowed 
page returned by Nginx.  I am sure that I have correct credentials, and 
would not expect this page returned even if my credentials were incorrect.

Steps to recreate:

   1. from my laptop browser, connect to www.mysite.com/admin
   2. see default django login screen
   3. type known good account credentials
   4. see 405 Not Allowed page returned

What I expect to happen:

Following steps 1-3 above, in step 4, I expect to see either the default 
Django admin screen, or the default Django failed login screen (looks just 
like the login, with an error message).

The admin login behaves correctly on my laptop, but not on the production 
server.

Configurations between laptop (development) and production:

   1. production uses Nginx 1.4.6 and Gunicorn 17.5 on Ubuntu Linux 14.04.5
   2. laptop is MacOS 10.11.6 running the Django 1.10.1 development server 
   (manage.py run server)
   3. I have collected static files (so far, they only exist for the 
   built-in admin) into a static directory in the root of the django project 
   (one level up from manage.py)


What I have tried:


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b7bb7b56-cbec-4bc0-9c47-96b5175e390c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Admin login returns 405 Not Allowed

2016-09-04 Thread Peter Laudenslager
Sorry - somehow posted too early.

For a moment I thought I had this sorted.  I had slightly different versions of 
Django between my development and production environments, and some of the 
static files for the admin pages had changed.  It made sense that when Nginx 
redirected the static file requests, the new resources weren't there.  Upgraded 
both environments to the latest Django (now 1.10.1), recollected static files, 
and got it to work.

Just to prove the point, I logged out, and tried to login with a different 
account, but got the 405 page again.  So I tried the first account again with 
no success.  Except for that one successful login, everything continues to 
return the 405 error.

>From the errors in the Django log, it still seems like I may be missing a 
>static file, or maybe a permissions problem on a directory, but no clear 
>pointer to a specific file or directory.

Anyone have any tips on how to troubleshoot this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5fb3f079-5dc2-4ca5-bbc7-1dd49416568c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin login returns 405 Not Allowed

2016-09-05 Thread Peter Laudenslager

>
> Here is the specific error logged by Django's debug logger:


Exception while resolving variable 'is_popup' in template 
'admin/login.html'.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", 
line 907, in _resolve_lookup
(bit, current))  # missing attribute
VariableDoesNotExist: Failed lookup for key [is_popup] in u"[{'False': 
False, 'None': None, 'True': True}, {u'csrf_token': >, 'user': >, 
'perms': , 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 
'WARNING': 30, 'SUCCESS': 25, 'ERROR': 40}, 'messages': 
, u'request': }, {}, {'username': u'', 'app_path': 
u'/admin/login/?next=/admin/', 'available_apps': [], 'site_name': 
'app_server', 'form': , 'title': u'Log in', 'site_header': 
, 'site': 
, 
'next': u'/admin/', 'site_title': , u'LANGUAGE_CODE': 'en-us', 'has_permission': False, 
'site_url': '/', u'LANGUAGE_BIDI': False}]" 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6653fbd4-4903-4ffa-84d7-ecac4d846f1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Admin login returns 405 Not Allowed

2016-09-05 Thread Peter Laudenslager
PARTIALLY SOLVED!!

The trouble seems to be with memcached.  I commented out references to 
memcached in the nginx configuration, and things started working properly.

I assume the admin page can be used with memcached, but something is wrong 
with my configuration.  Maybe related to the post command?  (so far, the 
rest of my site uses "get" only, other than the admin pages).

below is a snip from the nginx configuration file (in sites-available).   
The memcached lines are commented out:

location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;

#set $memcached_key "$uri?$args";
#memcached_pass 127.0.0.1:11211;
#error_page 404 502 504 = @fallback;
}

location @fallback {
proxy_pass http://app_server;
}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/75a599b1-d9a7-4b9e-b4d7-a3c964a3ace5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.