Hello again,

I just had a WTF moment. I kept trying to access 192.168.1.4/admin which
opened 0.0.0.0:8000 consistently for the last couple of hours (notice this
is not localhost). Then I've read somewhere: "check with curl what kind of
reponse you get directly from gunicorn". So I did and it was fine, I got
the login form. Then I had a hunch - maybe it's something wrong with my
browser, Chrome. Turns out I was right - it worked in incognito mode! I
tried again with normal tab - again 0.0.0.0:8000. So I tried
http://192.168.1.4/admin/ with the slash at the end and voila! Admin login
form. Now even without the slash at the end I get the login form everytime.

Please, somebody explain this to me. I wasted so much time on this, tried
so many nginx configurations and I still don't know what I did wrong. It's
voodoo. ;)

Best regards,
Daniel Ozminkowski

2013/7/18 Daniel Oźminkowski <[email protected]>

> Hello,
>
> first I want to state, that I am a beginner and everything still works a
> little like magic for me. I have always worked with django by running it
> with runserver. Recently decided to put it on virtual machine and serve the
> site with nginx + gunicorn. I understand how to serve static files and so
> on. Even my app works. I hit the problem when I try to access built-in
> admin interface. Everytime when I go to http://VMip/admin I get
> redirected to http://127.0.0.1:8000/.
>
> I made sure that SITE_ID is the same in settings.py and the django_site
> table.
>
> The server is on a VM, I access it by ip. Here is my nginx config in
> sites-enabled/my_app.
>
> server {
>     server_name 192.168.0.112; # I noticed it doesn't matter. Nginx serves
> the site even if VM ip changes... hmmm?
>     listen 80;
>
>     root /home/daniel/www
>     index index.html index.htm
>     client_max_body_size 32M;
>     client_body_buffer_size 128k;
>     location /static/ {
>         root /home/daniel/www
>     }
>
>     location / {
>         proxy_pass_header Server;
>         proxy_set_header Host $http_host;
>         proxy_redirect off;
>         proxy_set_header X-Real-IP $remote_addr;
>         proxy_set_header X-Scheme $scheme;
>         proxy_connect_timeout 10;
>         proxy_read_timeout 10;
>         proxy_pass http://localhost:8000/;
>     }
> }
>
> I will be very grateful for any clues how to fix it. Thanks!
>
> Best regards,
> Daniel
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/ZbtZ9d8YPXo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to