[uWSGI] nginx+uwsgi problem: Can't set empy SCRIPT_NAME param

Andrey Petrov shazow at gmail.com
Sun Jul 4 08:29:55 CEST 2010


Ah I figured out my logging issue. Changed my DynamicApps wsgi loader module
to have this at the top:


import logging.config
logging.config.fileConfig('/var/lib/wsgi/src/myproject/staging.ini')


I was assuming this would be done by paste.deploy.loadapp but I was wrong.

Sorry for the bother,

- Andrey

On Sat, Jul 3, 2010 at 11:14 PM, Andrey Petrov <shazow at gmail.com> wrote:

> Ok, figured out why the error was happening. It was because I had uwsgi
> 0.9.5 and it had a paste bug. Installing 0.9.5.1 fixed this.
>
> Unfortunately turns out that Paste (1.7.4) assumes that there is a
> SCRIPT_NAME key (even if the value is "") and otherwise raises an exception
> for any URL that isn't /. If I use --paste for uwsgi and don't supply a
> SCRIPT_NAME in nginx, it breaks. So I reverted back to the DynamicApps setup
> with my wsgi wrapper that removes the extraneous slash.
>
> I still can't figure out why the logger configuration isn't being setup at
> all, though.
>
> (Also, looks like I might have accidentally hijacked another thread
> somehow. Apologies if that is the case.)
>
> - Andrey
>
> On Sat, Jul 3, 2010 at 6:02 PM, Andrey Petrov <shazow at gmail.com> wrote:
>
>> Do you really need dynamic apps ?
>>>
>>> To run pylons apps you can simply use:
>>>
>>> http://projects.unbit.it/uwsgi/wiki/UsePaste
>>>
>>
>> I tried to set this up using the --paste flag, but I still get "wsgi
>> application not found".
>>
>> Here's my uwsgi command:
>>
>> uwsgi -s /tmp/uwsgi.sock -H /var/lib/wsgi/ --paste
>> config:/var/lib/wsgi/src/myproject/staging.ini \
>> --uid 33 --gid 33 -M --pythonpath /var/lib/wsgi/src/myproject --pythonpath
>> /var/lib/wsgi
>>
>>
>> I tried various combinations of --pythonpath (with and without and
>> pointing to different places like /var/lib/wsgi/lib/python-2.6/site-packages
>> and such).
>>
>> And the nginx configuration is simply:
>>
>>         location / {
>>                 uwsgi_pass   unix:///tmp/uwsgi.sock;
>>                 include        uwsgi_params;
>>         }
>>
>> Is there anything obvious I'm missing?
>>
>> Also another problem I've encountered is that my logging configurations in
>> the .ini are not being respected when I run through uwsgi (as opposed
>> through paster). For example, in the staging.ini, I have a logger that I
>> define to write through RotatingFileHandler that I call explicitly with
>> every request inside of the application but it's not getting written when
>> running through uwsgi. Any thoughts on this?
>>
>> Excerpt from staging.ini:
>>
>> [loggers]
>> keys = root, history
>>
>> ...
>>
>> [logger_history]
>> level = DEBUG
>> handlers = history
>> qualname = history
>>
>> [handler_history]
>> class = handlers.RotatingFileHandler
>> args = ('/var/lib/wsgi/src/myproject/history.log','a', 20000000, 10)
>> level = NOTSET
>> formatter = simpler
>>
>>
>> Thank you again and I'm looking forward to your polishing of the nginx
>> uwsgi params interface (re SCRIPT_NAME). :)
>>
>> - Andrey
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.unbit.it/pipermail/uwsgi/attachments/20100703/f68069c9/attachment.htm 


More information about the uWSGI mailing list