Windows: Running a Pyramid Application under Apache+mod_wsgi.

閲覧: 301 回
最初の未読メッセージにスキップ

jkd

未読、
2011/10/27 10:51:432011/10/27
To: pylons-devel
This is in reply the request for Windows experience with "Running a
Pyramid Application under mod_wsgi" that was made in
http://docs.pylonsproject.org/projects/pyramid/1.1/tutorials/modwsgi/index.html#modwsgi-tutorial
.

I'm a newbie at Python, Pyramid, Apache and mod_wsgi, yet getting it
all to work wasn't as difficult as I had feared.

The final deployment steps on Windows turned out to be essentially the
same as those in the tutorial above.

Here's my setup and how I got to the end result:

A Windows developmental environment for Apache is provided by
WampServer: http://www.wampserver.com .

A system-wide Python, plus the usual utilities virtualenv and
simple_install, are installed in D:\PF\Python27\.

For learning about, setting up and testing mod_wsgi with Apache, the
documentation at http://code.google.com/p/modwsgi/ proved to be clear,
thorough and indispensable.

Also valuable are the docs at the WSGI.org site. They contain
tutorials that further explain and explore WSGI applications.

Some simple tutorial scripts from WSGI.org were tested, initially
using the wsgiref Python server, and later using Apache+mod_wsgi.

Then, focus turned to learning Pyramid.

See: http://docs.pylonsproject.org/projects/pyramid/1.1/index.html .

Create a new Python environment called PyramidEnv. D:\P\ is my Python
project sandbox.

D:
cd \P\
virtualenv --no-site-packages D:/P/PyramidEnv/

Activate this environment and install Pyramid in it:

cd \P\PyramidEnv\
Scripts\activate
easy_install pyramid

Create and test the first non-trivial project, calling it MyProject:

Scripts\paster create -t pyramid_starter MyProject
cd MyProject
..\Scripts\python setup.py develop
..\Scripts\python setup.py test -q

The test results returned an "OK", so paster's server was launched for
a browser test:

..\Scripts\paster serve development.ini

http://127.0.0.1:6543 displayed MyProject's welcome screen.

A CTRL-C (or two) exited the server loop. To bring the system-wide
Python back, deactivate the PyramidEnv with:

deactivate

Before continuing with the tutorial to enhance MyProject, test a
deployment of it to Apache+mod wsgi:

cd \P\PyramidEnv\

Create a WSGI script file in this directory, called RunMyProject,
containing two lines:

from pyramid.paster import get_app
application = get_app('D:/P/PyramidEnv/MyProject/production.ini',
'main')

Set up Apache's mod_wsgi in the header portion of its httpd.conf file:

WSGIScriptAlias /PE/ D:/P/PyramidEnv/
WSGIPythonHome D:/P/PyramidEnv/

The trailing '/' on '/PE/' indicates that the name of the WSGI script
to be executed will be specified in the requesting URL.

And allow Apache to access D:/P/PyramidEnv/ with these commands, also
in the header section of httpd.conf:

<Directory D:/P/PyramidEnv/>
Order allow,deny
Allow from all
</Directory>

http://127.0.0.1/PE/RunMyProject/ confirms that Apache+mog_wsgi serves
up MyProject's welcome screen.

###

Tres Seaver

未読、
2011/10/27 13:10:062011/10/27
To: pylons...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/27/2011 10:51 AM, jkd wrote:
> This is in reply the request for Windows experience with "Running
> a Pyramid Application under mod_wsgi" that was made in
> http://docs.pylonsproject.org/projects/pyramid/1.1/tutorials/modwsgi/index.html#modwsgi-tutorial
>
>
.
>
> I'm a newbie at Python, Pyramid, Apache and mod_wsgi, yet getting
> it all to work wasn't as difficult as I had feared.
>
> The final deployment steps on Windows turned out to be essentially
> the same as those in the tutorial above.
>
> Here's my setup and how I got to the end result:

<snip>

> http://127.0.0.1/PE/RunMyProject/ confirms that Apache+mog_wsgi
> serves up MyProject's welcome screen.


Cool, thanks for sharing / confirming that it works for you!

Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tse...@palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6pkG4ACgkQ+gerLs4ltQ6qJACfRHvPsNGVBhI4k/0VFZuHtLI0
lukAoJCxGhobfLMjahUeTRF25qd/S8x+
=o4kA
-----END PGP SIGNATURE-----

Anton Butsyk

未読、
2017/03/25 17:09:182017/03/25
To: pylons-devel、kelly....@gmail.com
Hello,

My experience with deployment apache+mod_wsgi under windows,
for the tutorials/modwsgi/index.html.

Env: Windows 10, Apache/2.4.25 (Win32) OpenSSL/1.0.2k mod_wsgi/4.5.15 Python/2.7

C:/Projects/sqla_demo/
├── venv/
├── sqla_demo/

--------------
wsgi.conf:
-------------

WSGIPythonPath  "C:/Projects/sqla_demo/venv/Lib/site-packages"
WSGIScriptAlias /myapp "C:/Projects/sqla_demo/pyramid.wsgi"

<Directory C:/Projects/sqla_demo>
  Require all granted
</Directory>
=========================

pyramid.wsgi is exactly the same as in tutorials/modwsgi/index.html
but ini_path updated:
ini_path = 'C:/Projects/sqla_demo/production.ini'

------------------
pyramid.wsgi
------------------
from pyramid.paster import get_app, setup_logging
ini_path = 'C:/Projects/sqla_demo/production.ini'
setup_logging(ini_path)
application = get_app(ini_path, 'main')

=========================

Page works correct, can see requests in logs for:
MySQL (MySQL-python==1.2.5, SQLAlchemy==1.1.6)
Redis   (pyramid-redis-sessions==1.0.1)

boom -c 50 -n 300
RPS: ~145 (Pretty good)

Kind regards
全員に返信
投稿者に返信
転送
新着メール 0 件