What is filename extension may use in wsgi application ?

37 views
Skip to first unread message

Евгений Негрий

unread,
Feb 7, 2012, 6:17:39 AM2/7/12
to modwsgi
What is filename extension may use in wsgi application ? *.wsgi or
*.py ? What difference ?
Sorry for stuped question.

Graham Dumpleton

unread,
Feb 7, 2012, 6:29:33 AM2/7/12
to mod...@googlegroups.com

There is no specific extension you must use.

Whatever the extension it is still Python code in it.

The reason that a .wsgi extension was promoted instead of .py was to
avoid people trying to import the WSGI script file as a Python module.
Doing so would have resulted in two copies of the module in memory
because when loaded as a WSGI script file it is assigned a module name
generated based on the full path to the WSGI script file. This is in
contrast to a module import where the name is based on basename (just
filename without extension) of the file.

So, you could use:

WSGIScriptAlias / /some/path/app.wsgi

or:

WSGIScriptAlias / /some/path/app.py

or even:

WSGIScriptAlias / /some/path/django.app

The mod_wsgi module will not care and will load the file regardless.

Same applies to other methods of configuring mod_wsgi but I will not
go into those so as to avoid confusing things by giving too many
options.

Graham

Reply all
Reply to author
Forward
0 new messages