Re: NGINX + GUNICORN

2020-09-11 Thread Julio Cojom
It depends, some people use virtualenvs, so you need to install gunicorn in
each project.

https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04

this might help, just change dependencies install to fit your os.

In my case, I deploy multiple projects with the same python and
dependencies install without virtualenv and made a little script, need
improvement but it's enough to pull some project from a repo and install
the app.

It take 3 params, repository, db name and domain name.
db name equals to project name in my case.







El vie., 11 sept. 2020 a las 4:44, Kasper Laudrup ()
escribió:

> Hi Giovanni,
>
> On 11/09/2020 12.24, Giovanni Silva wrote:
> > No...
> > I want to access www.aidacomunicacao.com.br
> >  and I hope see the django webpage
> >
>
> Then don't listen on port 81, but use the default port 80 for
> non-encrypted HTTP traffic.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9b32d1a8-b947-6b48-0e93-aab3dae8470a%40stacktrace.dk
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHRQUHni7xh79yr0k4TJRCxRmtkLMgf7Xv57ktKB%2BsFL0WOqxw%40mail.gmail.com.
#!/bin/bash

#1. clone repo and cd

cd /home/user/
git clone $1
REPO=$1
FOLDER=${REPO%.*}
FOLDER=${FOLDER##*/}

cd $FOLDER

# crea .env
#improve to make random str to secret key
cat > /home/user/$FOLDER/.env << EOL
SECRET_KEY=some_secreat_key
ALLOWED_HOSTS=localhost,$3, www.$3
DEBUG=True
DB_NAME=$2
DB_USER=$2
HOST=some_host
PORT=some port
DB_PASSWORD=some_password
PRODUCTION=True
EOL

#asigna permisos a la carpeta de la app
cd ..
chown -R user:user $FOLDER

#Creación de socket
cat > /etc/systemd/system/gunicorn_$2.socket << EOL
[Unit]
Description=$2 socket"

[Socket]
ListenStream=/run/gunicorn_$2.sock

[Install]
WantedBy=sockets.target
EOL

APP=${FOLDER//-/_}

#creación de servicio
cat > /etc/systemd/system/gunicorn_$2.service << EOL
[Unit]
Description=$2 daemon
Requires=gunicorn_$2.socket
After=network.target

[Service]
User=user
Group=www-data
WorkingDirectory=/home/user/$FOLDER
ExecStart=/usr/local/bin/gunicorn --access-logfile - --workers 3 --bind 
unix:/run/gunicorn_$2.sock $APP.wsgi:application
[Install]
WantedBy=multi-user.target
EOL

#inicia y habilita el servicio
systemctl daemon-reload
systemctl stop gunicorn_$2.socket
systemctl start gunicorn_$2.socket
systemctl daemon-reload
systemctl enable gunicorn_$2.socket

#habilita salida http
#bad practice, shoud ln to www/var/html and nginx go to www/var/html inestead 
of home/user/proyect
cat > /etc/nginx/sites-available/$3 << EOL
server {
server_name $3 www.$3;
location = /favicon.ico { access_log off; log_not_found off; }

location /staticfiles/ {
root /home/user/$FOLDER;
}
location /media/ {
root /home/user/$FOLDER;
}

location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn_$2.sock;
}
}
EOL


ln -s /etc/nginx/sites-available/$3 /etc/nginx/sites-enabled

nginx -t

systemctl restart nginx

certbot --nginx -d $3 -d www.$3



Re: NGINX + GUNICORN

2020-09-11 Thread Kasper Laudrup

Hi Giovanni,

On 11/09/2020 12.24, Giovanni Silva wrote:

No...
I want to access www.aidacomunicacao.com.br 
 and I hope see the django webpage




Then don't listen on port 81, but use the default port 80 for 
non-encrypted HTTP traffic.


Kind regards,

Kasper Laudrup

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9b32d1a8-b947-6b48-0e93-aab3dae8470a%40stacktrace.dk.


Re: NGINX + GUNICORN

2020-09-11 Thread Giovanni Silva
No...
I want to access www.aidacomunicacao.com.br and I hope see the django
webpage

Em sex, 11 de set de 2020 04:39, Kasper Laudrup 
escreveu:

> Hi Giovanni,
>
> On 10/09/2020 23.58, Giovanni Silva wrote:
> > */This doesn't work. /*
> >
> > NGINX - FILE
> > server {
> >  listen 81;
> >  server_name www.aidacomunicacao.com.br
>
> If I go to http://www.aidacomunicacao.com.br:81/ as you have configured
> here, I see the default Django welcome page.
>
> Is this not what you expected?
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b82a98c4-0bb1-858f-fa4d-8779525f3cad%40stacktrace.dk
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABO2r9dM-TaTQ4Jt6VU545SjZm4B3SSNa11pwk5SJFCFWBOJCA%40mail.gmail.com.


Re: NGINX + GUNICORN

2020-09-11 Thread Kasper Laudrup

Hi Giovanni,

On 10/09/2020 23.58, Giovanni Silva wrote:

*/This doesn't work. /*

NGINX - FILE
server {
     listen 81;
     server_name www.aidacomunicacao.com.br 


If I go to http://www.aidacomunicacao.com.br:81/ as you have configured 
here, I see the default Django welcome page.


Is this not what you expected?

Kind regards,

Kasper Laudrup

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b82a98c4-0bb1-858f-fa4d-8779525f3cad%40stacktrace.dk.


Re: NGINX + GUNICORN

2020-09-11 Thread Sunday Iyanu Ajayi
>From what I see, you what to host your webapp on two domain name (addresses)

1. www.ascende.com.br; :80
2.  www.aidacomunicacao.com.br :80

Right???
*AJAYI Sunday *
(+234) 806 771 5394
*sunnexaj...@gmail.com *



On Thu, Sep 10, 2020 at 10:59 PM Giovanni Silva  wrote:

> Hello..
>
> *This webpage works fine:*
>
> NGINX - FILE
> server {
> listen 80;
> server_name www.ascende.com.br;
>
> location = /favicon.ico { access_log off; log_not_found off; }
> location /static/ {
> root /home/ascende/Site;
> }
>
> location / {
> include proxy_params;
> proxy_pass http://unix:/run/gunicorn.sock;
> }
> }
>
> GUNICORN SOCKET
> [Unit]
> Description=gunicorn socket
>
> [Socket]
> ListenStream=/run/gunicorn.sock
>
> [Install]
> WantedBy=sockets.target
>
> GUNICORN SERVICE
> [Unit]
> Description=gunicorn daemon
> Requires=gunicorn.socket
> After=network.target
>
> [Service]
> User=ascende
> Group=www-data
> WorkingDirectory=/home/ascende/Site
> ExecStart=/home/ascende/Site/venv/bin/gunicorn \
>   --access-logfile - \
>   --workers 3 \
>   --bind unix:/run/gunicorn.sock \
>   SiteAscende.wsgi:application
>
> [Install]
> WantedBy=multi-user.target
>
> *This doesn't work. *
>
> NGINX - FILE
> server {
> listen 81;
> server_name www.aidacomunicacao.com.br;
>
> location = /favicon.ico { access_log off; log_not_found off; }
> location /static/ {
> root /home/aida/Site;
> }
>
> location / {
> include proxy_params;
> proxy_pass http://unix:/run/siteaida.sock;
> }
> }
>
> GUNICORN SOCKET2
> [Unit]
> Description=siteaida socket
>
> [Socket]
> ListenStream=/run/siteaida.sock
>
> [Install]
> WantedBy=sockets.target
>
> GUNICORN SERVICE2
> [Unit]
> Description=siteaida daemon
> Requires=siteaida.socket
> After=network.target
>
> [Service]
> User=aida
> Group=www-data
> WorkingDirectory=/home/aida/Site
> ExecStart=/home/aida/Site/venv/bin/gunicorn \
>   --access-logfile - \
>   --workers 3 \
>   --bind unix:/run/siteaida.sock \
>   SitaAIDA.wsgi:application
>
> [Install]
> WantedBy=multi-user.target
>
>
> Em qui., 10 de set. de 2020 às 04:52, Kasper Laudrup <
> laud...@stacktrace.dk> escreveu:
>
>> Hi Giovanni,
>>
>> On 10/09/2020 07.59, Giovanni Silva wrote:
>> > Dears,
>> >
>> > can anyone help-me to configure a NGINX + GUNICORN to multiple projects?
>> >
>> > for the first project everything is work fine, for the second project,
>> I
>> > create a new .socket file and new service file..
>> >
>> > The nginx and gunicorn is running, but when I try to access my site,
>> > appears the default page of nginx..
>> >
>> > Any suggestions??
>> >
>>
>> You would probably have a better chance of getting some help if you
>> provide us with the relevant parts of your nginx configuration and a bit
>> more information about your setup (OS etc.).
>>
>> Anyway, have you tried following this guide:
>>
>>
>> http://michal.karzynski.pl/blog/2013/10/29/serving-multiple-django-applications-with-nginx-gunicorn-supervisor/
>>
>> Kind regards,
>>
>> Kasper Laudrup
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/dd25b9fd-60c3-8f2f-5f76-886ec8d2e649%40stacktrace.dk
>> .
>>
>
>
> --
> *Giovanni Silva*
> (31) 9 9532-1877
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABO2r9dM82yukSLGPtJ7okynr-cTXF5%3DP8G85wqjxT8rDLeV_w%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABO2r9dM82yukSLGPtJ7okynr-cTXF5%3DP8G85wqjxT8rDLeV_w%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKYSAw3H%3DZ8K8zqqT%3DdjFAD9cqiY40gNQu7u09vYFTyqZ7W0Lw%40mail.gmail.com.


Re: NGINX + GUNICORN

2020-09-10 Thread Giovanni Silva
Hello..

*This webpage works fine:*

NGINX - FILE
server {
listen 80;
server_name www.ascende.com.br;

location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/ascende/Site;
}

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

GUNICORN SOCKET
[Unit]
Description=gunicorn socket

[Socket]
ListenStream=/run/gunicorn.sock

[Install]
WantedBy=sockets.target

GUNICORN SERVICE
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target

[Service]
User=ascende
Group=www-data
WorkingDirectory=/home/ascende/Site
ExecStart=/home/ascende/Site/venv/bin/gunicorn \
  --access-logfile - \
  --workers 3 \
  --bind unix:/run/gunicorn.sock \
  SiteAscende.wsgi:application

[Install]
WantedBy=multi-user.target

*This doesn't work. *

NGINX - FILE
server {
listen 81;
server_name www.aidacomunicacao.com.br;

location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/aida/Site;
}

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

GUNICORN SOCKET2
[Unit]
Description=siteaida socket

[Socket]
ListenStream=/run/siteaida.sock

[Install]
WantedBy=sockets.target

GUNICORN SERVICE2
[Unit]
Description=siteaida daemon
Requires=siteaida.socket
After=network.target

[Service]
User=aida
Group=www-data
WorkingDirectory=/home/aida/Site
ExecStart=/home/aida/Site/venv/bin/gunicorn \
  --access-logfile - \
  --workers 3 \
  --bind unix:/run/siteaida.sock \
  SitaAIDA.wsgi:application

[Install]
WantedBy=multi-user.target


Em qui., 10 de set. de 2020 às 04:52, Kasper Laudrup 
escreveu:

> Hi Giovanni,
>
> On 10/09/2020 07.59, Giovanni Silva wrote:
> > Dears,
> >
> > can anyone help-me to configure a NGINX + GUNICORN to multiple projects?
> >
> > for the first project everything is work fine, for the second project, I
> > create a new .socket file and new service file..
> >
> > The nginx and gunicorn is running, but when I try to access my site,
> > appears the default page of nginx..
> >
> > Any suggestions??
> >
>
> You would probably have a better chance of getting some help if you
> provide us with the relevant parts of your nginx configuration and a bit
> more information about your setup (OS etc.).
>
> Anyway, have you tried following this guide:
>
>
> http://michal.karzynski.pl/blog/2013/10/29/serving-multiple-django-applications-with-nginx-gunicorn-supervisor/
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/dd25b9fd-60c3-8f2f-5f76-886ec8d2e649%40stacktrace.dk
> .
>


-- 
*Giovanni Silva*
(31) 9 9532-1877

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABO2r9dM82yukSLGPtJ7okynr-cTXF5%3DP8G85wqjxT8rDLeV_w%40mail.gmail.com.


Re: NGINX + GUNICORN

2020-09-10 Thread Sunday Iyanu Ajayi
In your nginx project file in /etc/nginx/site-available/xx, did you include
the ip of the server you are working on?
*AJAYI Sunday *
(+234) 806 771 5394
*sunnexaj...@gmail.com *



On Thu, Sep 10, 2020 at 7:00 AM Giovanni Silva  wrote:

> Dears,
>
> can anyone help-me to configure a NGINX + GUNICORN to multiple projects?
>
> for the first project everything is work fine, for the second project, I
> create a new .socket file and new service file..
>
> The nginx and gunicorn is running, but when I try to access my site,
> appears the default page of nginx..
>
> Any suggestions??
>
> Best regards,
>
> --
> *Giovanni Silva*
> (31) 9 9532-1877
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABO2r9dNQd24yM%3DDD-fjy9dNjV5GigYxxwNNFjtAivs5xfsKRQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CABO2r9dNQd24yM%3DDD-fjy9dNjV5GigYxxwNNFjtAivs5xfsKRQ%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKYSAw2zWO%3DOy8Ta%3DeswyY%3DeHhXRSZThFqKv4Ym_6DJaB4qDOA%40mail.gmail.com.


Re: NGINX + GUNICORN

2020-09-10 Thread 'Amitesh Sahay' via Django users
Please make sure that gunicorn.service file has same entry of project dir path 
as nginx.


Regards,
Amitesh 

On Thursday, 10 September, 2020, 01:09:20 pm IST, Giovanni Silva 
 wrote:  
 
 Dears, 
can anyone help-me to configure a NGINX + GUNICORN to multiple projects?
for the first project everything is work fine, for the second project, I create 
a new .socket file and new service file.. 
The nginx and gunicorn is running, but when I try to access my site, appears 
the default page of nginx.. 
Any suggestions??
Best regards,
-- 
Giovanni Silva(31) 9 9532-1877

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABO2r9dNQd24yM%3DDD-fjy9dNjV5GigYxxwNNFjtAivs5xfsKRQ%40mail.gmail.com.
  

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2098253062.527392.1599724310808%40mail.yahoo.com.


Re: NGINX + GUNICORN

2020-09-10 Thread Kasper Laudrup

Hi Giovanni,

On 10/09/2020 07.59, Giovanni Silva wrote:

Dears,

can anyone help-me to configure a NGINX + GUNICORN to multiple projects?

for the first project everything is work fine, for the second project, I 
create a new .socket file and new service file..


The nginx and gunicorn is running, but when I try to access my site, 
appears the default page of nginx..


Any suggestions??



You would probably have a better chance of getting some help if you 
provide us with the relevant parts of your nginx configuration and a bit 
more information about your setup (OS etc.).


Anyway, have you tried following this guide:

http://michal.karzynski.pl/blog/2013/10/29/serving-multiple-django-applications-with-nginx-gunicorn-supervisor/

Kind regards,

Kasper Laudrup

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dd25b9fd-60c3-8f2f-5f76-886ec8d2e649%40stacktrace.dk.


NGINX + GUNICORN

2020-09-10 Thread Giovanni Silva
Dears,

can anyone help-me to configure a NGINX + GUNICORN to multiple projects?

for the first project everything is work fine, for the second project, I
create a new .socket file and new service file..

The nginx and gunicorn is running, but when I try to access my site,
appears the default page of nginx..

Any suggestions??

Best regards,

-- 
*Giovanni Silva*
(31) 9 9532-1877

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABO2r9dNQd24yM%3DDD-fjy9dNjV5GigYxxwNNFjtAivs5xfsKRQ%40mail.gmail.com.


Post - Deploy project Django-Nginx,gunicorn,virtualenv and supervisor

2015-07-04 Thread Roberth Solis Martínez
Hi guys in this post i can learn, how to deploy app in server with django 
:), and i share it with us !


http://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eba3eb4d-2a09-4d71-98e4-bb64c08a840f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Deploying Django, nginx , gunicorn, postgresql

2015-02-20 Thread Tony Kyriakidis
Hello, 

It's been a week now since the day i started trying to deploy a test blog 
application on digital ocean.
I tried everthing and if you go to the IP: http://188.166.62.146 you get a 
Welcome to Nginx page.
when i go to http://188.166.62.146:8001 i get a (400 Bad Request) error.

Here on Stack overflow i posted every detail. Please take a look at it.

http://stackoverflow.com/questions/28629112/502-bad-gateway-django-nginx-gunicorn-postgresql-virtualenv?noredirect=1#comment45560477_28629112


Thank in advance.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8f9f2ac6-0699-4ce6-812d-0ae8f3564854%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: /admin redirects me to 127.0.0.1:8000/admin on nginx+gunicorn production server

2014-05-09 Thread Daniel Oźminkowski
Well, the whole description of how the error went away is down there in my
emails.

Try to access the page with curl and/or incognito mode and see what
response you get. Curl is a better choice, because you see all the details
of the response. If you are on Windows and dont have curl, then use Chrome
Developer Tools, they also tell you the details of the request.

Best regards,
Daniel Ozminkowski
9 maj 2014 09:00 "Francisco Roldan" <franciscoprol...@gmail.com> napisał(a):

> Hi!, i have the same issue with nginx. When i try to access to /admin or
> another url without slash o when django redirects, nginx redirect to
> 127.0.0.1/admin.
> How you solved?
>
> Thanks, sorry my english
>
> El jueves, 25 de julio de 2013 06:43:51 UTC-3, Daniel Oźminkowski escribió:
>>
>> I thought that it may be connected to Chrome's Omnibox, but honestly now
>> I can not replicate that behaviour. It works fine in and out of incognito
>> mode.
>>
>> Best regards,
>> Daniel Ozminkowski
>>
>> 2013/7/24 Avraham Serour <tov...@gmail.com>
>>
>>> Well, if it works on incognito mode you should try cleaning your cookies
>>> On Jul 24, 2013 11:33 PM, "Daniel Oźminkowski" <dozmin...@gmail.com>
>>> wrote:
>>>
>>>> Hello again,
>>>>
>>>> I just had a WTF moment. I kept trying to access 192.168.1.4/adminwhich 
>>>> 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 <dozmin...@gmail.com>
>>>>
>>>>> 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,
>&g

Re: /admin redirects me to 127.0.0.1:8000/admin on nginx+gunicorn production server

2014-05-09 Thread Francisco Roldan
Hi!, i have the same issue with nginx. When i try to access to /admin or 
another url without slash o when django redirects, nginx redirect to 
127.0.0.1/admin.
How you solved?

Thanks, sorry my english

El jueves, 25 de julio de 2013 06:43:51 UTC-3, Daniel Oźminkowski escribió:
>
> I thought that it may be connected to Chrome's Omnibox, but honestly now I 
> can not replicate that behaviour. It works fine in and out of incognito 
> mode.
>
> Best regards,
> Daniel Ozminkowski
>
> 2013/7/24 Avraham Serour <tov...@gmail.com >
>
>> Well, if it works on incognito mode you should try cleaning your cookies
>> On Jul 24, 2013 11:33 PM, "Daniel Oźminkowski" 
>> <dozmin...@gmail.com> 
>> wrote:
>>
>>> Hello again,
>>>
>>> I just had a WTF moment. I kept trying to access 192.168.1.4/adminwhich 
>>> 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 <dozmin...@gmail.com >
>>>
>>>> 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 
>>>> django-users...@googlegroups.com .
>>>> To post to this group, send email to 
>>>> django...@googlegroups.com
>>>> .
>>>> Visit this group at http://groups.google.com/group/django-users.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>  
>>>

Re: /admin redirects me to 127.0.0.1:8000/admin on nginx+gunicorn production server

2013-07-25 Thread Daniel Oźminkowski
I thought that it may be connected to Chrome's Omnibox, but honestly now I
can not replicate that behaviour. It works fine in and out of incognito
mode.

Best regards,
Daniel Ozminkowski

2013/7/24 Avraham Serour <tovm...@gmail.com>

> Well, if it works on incognito mode you should try cleaning your cookies
> On Jul 24, 2013 11:33 PM, "Daniel Oźminkowski" <dozminkow...@gmail.com>
> wrote:
>
>> 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 <dozminkow...@gmail.com>
>>
>>> 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
>>> django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> 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 django-users+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> 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 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
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> 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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: /admin redirects me to 127.0.0.1:8000/admin on nginx+gunicorn production server

2013-07-24 Thread Mike Doroshenko II
I think this is a bug in Django. I am not using Nginx or Gunicorn and am 
also experiencing the same issue.


http://sandbox.junior.evandro.dev.tecknoquest.com/
On that page the "Customer Service Django App 
<http://sandbox.junior.evandro.dev.tecknoquest.com/cs>" link works with 
and without a slash at the end.


http://ballin.mikedoroshenko.com/
Backup copy of the site above (when I just purchased that domain and was 
playing around with DNS hence the ballin name lol). On that site 
clicking the same link on this site opens the user's browser to 
localhost instead of proxying. I get redirected to localhost without 
even seeing any output come up in terminal window for the dev server. 
Adding a slash makes it work fine.



Daniel Oz'minkowski wrote:

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 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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


--
Mike Doroshenko, Junior Sys Admin
TecKnoQuest Inc.
mi...@tecknoquest.com
www.tecknoquest.com

--
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: /admin redirects me to 127.0.0.1:8000/admin on nginx+gunicorn production server

2013-07-24 Thread Avraham Serour
Well, if it works on incognito mode you should try cleaning your cookies
On Jul 24, 2013 11:33 PM, "Daniel Oźminkowski" <dozminkow...@gmail.com>
wrote:

> 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 <dozminkow...@gmail.com>
>
>> 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
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> 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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: /admin redirects me to 127.0.0.1:8000/admin on nginx+gunicorn production server

2013-07-24 Thread Daniel Oźminkowski
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 <dozminkow...@gmail.com>

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




/admin redirects me to 127.0.0.1:8000/admin on nginx+gunicorn production server

2013-07-18 Thread Daniel Oźminkowski
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 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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: nginx gunicorn

2011-12-19 Thread Dusan Simek

Yes, apache with mod_wsgi the same - processor overload on benchmark.
Is it problem in application?

On Mon, 19 Dec 2011 13:15:09 +0100, kenneth gonsalves  
 wrote:



On Mon, 2011-12-19 at 02:17 -0800, pixelfields wrote:

but ... this not solved my problem. I increase worker_processes to 2,
but during test I still have processor overload 98% - 100%.




how many workers do you have for gunicorn? Also do you have the same
problem when using some other webserver with nginx (or apache with
mod_wsgi)?


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: nginx gunicorn

2011-12-19 Thread Dusan Simek

For gunicorn I have 2 workers:

gunicorn:

[program:xxx]
command=/usr/local/bin/gunicorn_django -w 2 -b 127.0.0.1:8002 --timeout  
600 /usr/local/src/pythonapps/xxx/app/settings_production.py

directory=/usr/local/src/pythonapps/xxx
user=www-data
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/xxx.supervisord.log
redirect_stderr=true

Now I try app to apache and benchmark it.




On Mon, 19 Dec 2011 13:15:09 +0100, kenneth gonsalves  
 wrote:



On Mon, 2011-12-19 at 02:17 -0800, pixelfields wrote:

but ... this not solved my problem. I increase worker_processes to 2,
but during test I still have processor overload 98% - 100%.




how many workers do you have for gunicorn? Also do you have the same
problem when using some other webserver with nginx (or apache with
mod_wsgi)?


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: nginx gunicorn

2011-12-19 Thread kenneth gonsalves
On Mon, 2011-12-19 at 02:17 -0800, pixelfields wrote:
> but ... this not solved my problem. I increase worker_processes to 2,
> but during test I still have processor overload 98% - 100%.
> 
> 

how many workers do you have for gunicorn? Also do you have the same
problem when using some other webserver with nginx (or apache with
mod_wsgi)?
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: nginx gunicorn

2011-12-19 Thread pixelfields
Thanks a lot,
but ... this not solved my problem. I increase worker_processes to 2,
but during test I still have processor overload 98% - 100%.

regards

Dusan Simek

On Dec 19, 10:59 am, kenneth gonsalves  wrote:
> On Mon, 2011-12-19 at 09:03 +0100, Dusan Simek wrote:
> > worker_processes  1;
>
> worker_processes  2 or more;
> --
> regards
> Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: nginx gunicorn

2011-12-19 Thread kenneth gonsalves
On Mon, 2011-12-19 at 09:03 +0100, Dusan Simek wrote:
> worker_processes  1;

worker_processes  2 or more;
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Fwd: nginx gunicorn

2011-12-19 Thread Dusan Simek


Sorry,
and additonal configuration:

nginx:

 location / {
proxy_pass  http://server;
proxy_redirect  off;
proxy_set_headerHost$host;
proxy_set_headerX-Real-IP   $remote_addr;
proxy_set_headerX-Forwarded-For  
$proxy_add_x_forwarded_for;

proxy_buffering on;
proxy_buffer_size   4k;
proxy_buffers   4  32k;
proxy_connect_timeout 500;
proxy_read_timeout 500;
if (!-f $request_filename) {
proxy_pass http://server;
break;
}
}

gunicorn:

[program:xxx]
command=/usr/local/bin/gunicorn_django -w 2 -b 127.0.0.1:8002 --timeout  
600 /usr/local/src/pythonapps/xxx/app/settings_production.py

directory=/usr/local/src/pythonapps/xxx
user=www-data
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/xxx.supervisord.log
redirect_stderr=true

django:

using johnny cache with memcache for caching all select queries, so at  
time of test app not touch a database


Thanks

ds



--- Forwarded message ---
From: "Dusan Simek" <pixelfie...@gmail.com>
To: django-users@googlegroups.com
Cc:
Subject: nginx gunicorn
Date: Mon, 19 Dec 2011 09:03:05 +0100

Hi guys,
I just finished with easy application based on django 1.3 and postgres and
deploy it to production using nginx, gunicorn and supervisor.
But now I have a big problem, because when I run a stress test (using ab
with params ab -c 100 -n 1000), my 2 core processor is totally overload,
running all the time on 100% and the site time out.
Please can anybody help me?

My configuration:

nginx:

worker_processes  1;
worker_rlimit_nofile 5120;

error_log  /var/log/nginx/error.log warn;
pid/var/run/nginx.pid;


events {
  worker_connections  3074;
  #multi_accept on;
}

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



nginx gunicorn

2011-12-19 Thread Dusan Simek

Hi guys,
I just finished with easy application based on django 1.3 and postgres and  
deploy it to production using nginx, gunicorn and supervisor.
But now I have a big problem, because when I run a stress test (using ab  
with params ab -c 100 -n 1000), my 2 core processor is totally overload,  
running all the time on 100% and the site time out.

Please can anybody help me?

My configuration:

nginx:

worker_processes  1;
worker_rlimit_nofile 5120;

error_log  /var/log/nginx/error.log warn;
pid/var/run/nginx.pid;


events {
worker_connections  3074;
#multi_accept on;
}

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.