problems with uwsgi, virtualenv, nginx and turbogears setup

190 views
Skip to first unread message

alind

unread,
Jun 24, 2012, 2:12:19 PM6/24/12
to turbo...@googlegroups.com
Hi all. We have developed one application for in-house usage using TG. I want to host it on nginx and uwsgi (attempting to learn them via  tg hosting).
I am unable to get it done by reading on the web. My tgenv virtualenv is at /home/web/tg2unsenv
I am using Debian.
My tg 2.2 application is at /home/web/projects/example22/
My /etc/nginx.conf -> http://pastebin.com/2LrCZizm
My /etc/nginx/sites-enabled/gmatweb_nginx.conf -> http://pastebin.com/Kj4Htjbd         
My /etc/uwsgi/apps-enabled/vhost.ini -> http://pastebin.com/aUynQumx                       

Can somebody guide me where I am wrong or the (huge) gap in my understanding.

alind

unread,
Jun 24, 2012, 2:56:09 PM6/24/12
to turbo...@googlegroups.com

I have copied my development.ini file to production.ini file.
Presently I have kept it unchanged. Later when the hosting works, I will convert it into a full  fledged production-config.

Alessandro Molina

unread,
Jun 25, 2012, 8:02:34 AM6/25/12
to turbo...@googlegroups.com
I have always deployed using mod_wsgi so I cannot really help with
specific uWSGI configuration, maybe other users can be more useful
than me on this.

The suggestion I can give you is to look for documentation about uWSGI
and Pylons, most of the guides that work with Pylons should work with
TG too.
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/turbogears/-/vNEdfq9kNU0J.
> To post to this group, send email to turbo...@googlegroups.com.
> To unsubscribe from this group, send email to
> turbogears+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/turbogears?hl=en.

alind

unread,
Jun 25, 2012, 11:04:07 AM6/25/12
to turbo...@googlegroups.com
Reading a bit more on internet, I understood (dont know if correctly) that wsgi section should be put in productiion.ini of my TG product.
Here is the productio.ini file -> http://pastebin.com/GfVijDUc
Running uwsgi inside by virtualenv with command runs.
   uwsgi --ini production.ini
But I dont know whether it is working properly. Going to 127.0.0.1 on my browser shows only the default nginx page. The moment I try to delete  the default page via deleting the /etc/nginx/sites-available/default , it browser shows 404 error at 127.0.0.1
I will try some other things....

On Monday, 25 June 2012 17:32:34 UTC+5:30, Alessandro Molina wrote:
I have always deployed using mod_wsgi so I cannot really help with
specific uWSGI configuration, maybe other users can be more useful
than me on this.

The suggestion I can give you is to look for documentation about uWSGI
and Pylons, most of the guides that work with Pylons should work with
TG too.

On Sun, Jun 24, 2012 at 8:12 PM, alind <alinds...@gmail.com> wrote:
> Hi all. We have developed one application for in-house usage using TG. I
> want to host it on nginx and uwsgi (attempting to learn them via  tg
> hosting).
> I am unable to get it done by reading on the web. My tgenv virtualenv is at
> /home/web/tg2unsenv
> I am using Debian.
> My tg 2.2 application is at /home/web/projects/example22/
> My /etc/nginx.conf -> http://pastebin.com/2LrCZizm
> My /etc/nginx/sites-enabled/gmatweb_nginx.conf ->
> http://pastebin.com/Kj4Htjbd
> My /etc/uwsgi/apps-enabled/vhost.ini ->
> http://pastebin.com/aUynQumx
>
> Can somebody guide me where I am wrong or the (huge) gap in my
> understanding.
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/turbogears/-/vNEdfq9kNU0J.
> To post to this group, send email to turbo...@googlegroups.com.
> To unsubscribe from this group, send email to
> turbogears+unsubscribe@googlegroups.com.

Carlos Daniel Ruvalcaba Valenzuela

unread,
Jun 25, 2012, 3:49:02 PM6/25/12
to turbo...@googlegroups.com

On Mon, Jun 25, 2012 at 8:04 AM, alind <alind...@gmail.com> wrote:
> Reading a bit more on internet, I understood (dont know if correctly) that
> wsgi section should be put in productiion.ini of my TG product.
> Here is the productio.ini file -> http://pastebin.com/GfVijDUc
> Running uwsgi inside by virtualenv with command runs.
>    uwsgi --ini production.ini

The --ini option is to specify an ini file with the uwsgi config, what you are looking for is the --paste option which specifies the absolute path to your production.ini (or development) file, just add the paste option on you uwsgi ini config.

Regards,
Carlos Daniel Ruvalcaba

alind

unread,
Jun 26, 2012, 2:42:36 AM6/26/12
to turbo...@googlegroups.com
Hi Carlos,
Thanks for replying.
I have added following two options in [uwsgi] section of production.ini that I have posted.
  • plugin = python
  • paste = config:/home/web/projects/example22/production.ini

  • I think that it takes care of the alternate options on command line
  • Besides when I use a tcp socket instead of file socket and run http server using uwsgi directly, I am able to see it on browser using uwsgi. But for some strange reasons, I can't get nginx to display uwsgi thing.

  • PS: uwsgi in python does not have --ini-paste and --paste options for some strange reasons.


Carlos Daniel Ruvalcaba Valenzuela

unread,
Jun 26, 2012, 3:55:08 AM6/26/12
to turbo...@googlegroups.com
Perhaps is the socket path that is causing you problem, in an example
app I have the following line on nginx config:


location / {
include uwsgi_params;
uwsgi_pass unix:/tmp/acatalog.sock;
}

As I see on your pasted files there are too many slashes ( / ), try
with just one root slash.

If you are using virtualenv don't forget to tell uwsgi about it, there
is many aliases, pythonpath, virtualenv, pp, etc.

Regards,
Carlos Daniel Ruvalcaba Valenzuela

jeetu

unread,
Jun 26, 2012, 11:05:30 AM6/26/12
to turbo...@googlegroups.com
Now I am trying with tcp socket in uwsgi. Still no success.

 new production.ini -> http://pastebin.com/CqwNfqYQ
 new gmatweb_nginx.conf -> http://pastebin.com/J6G0gy2u

But I am able to serve it directly using  uwsgi --http 127.0.0.1:8090 --ini production.ini

jeetu

unread,
Jun 26, 2012, 11:13:17 AM6/26/12
to turbo...@googlegroups.com

@Carlos

Hi
Can you send me your working production.ini and nginx.conf files.
I will compare mine and try to find the issues with my conf files.
Thanks in advance.

jeetu

unread,
Jul 1, 2012, 9:45:37 AM7/1/12
to turbo...@googlegroups.com

Hi all,
I am able to get my job done. Thanks to the people here and at Turbogears and Nginx's irc. I will write a blog post and put the link here in this thread for the full process ASAP.

Mengu

unread,
Jul 1, 2012, 10:28:03 AM7/1/12
to TurboGears
i really wonder what was the problem with your nginx & uwsgi setup.
i'm waiting for your post.

On Jul 1, 4:45 pm, jeetu <alindsha...@gmail.com> wrote:
> Hi all,
> I am able to get my job done. Thanks to the people here and at Turbogears
> and Nginx's irc. I will write a blog post and put the link here in this
> thread for the full process ASAP.
>
>
>
>
>
>
>
> On Tuesday, 26 June 2012 20:43:17 UTC+5:30, jeetu wrote:
>
> > @Carlos
>
> > Hi
> > Can you send me your working production.ini and nginx.conf files.
> > I will compare mine and try to find the issues with my conf files.
> > Thanks in advance.
>
> > On Tuesday, 26 June 2012 20:35:30 UTC+5:30, jeetu wrote:
>
> >> Now I am trying with tcp socket in uwsgi. Still no success.
>
> >>  new production.ini ->http://pastebin.com/CqwNfqYQ
> >>  new gmatweb_nginx.conf ->http://pastebin.com/J6G0gy2u
>
> >> But I am able to serve it directly using  uwsgi --http 127.0.0.1:8090--ini production.ini
Reply all
Reply to author
Forward
0 new messages