Deployment with Apache

Issue #40 new
created an issue

Is possible connect weezy.web to work with apache? Any example?

Comments (8)

  1. damufo reporter

    Help to deployment apache

    Hi, I put in ...apache2/sites-enabled/000-default.conf

    <VirtualHost *:80>
            # The ServerName directive sets the request scheme, hostname and port that
            # the server uses to identify itself. This is used when creating
            # redirection URLs. In the context of virtual hosts, the ServerName
            # specifies what hostname must appear in the request's Host: header to
            # match this virtual host. For the default virtual host (this file) this
            # value is not decisive as it is used as a last resort host regardless.
            # However, you must set it for any further virtual host explicitly.
            ServerAdmin webmaster@localhost
            DocumentRoot /var/www/html
            WSGIDaemonProcess proba_wsgi user=proba group=proba maximum-requests=10000
            WSGIScriptAlias /proba /home/proba/probaweb/
            <Location /proba>
                    WSGIProcessGroup proba_wsgi

    """ Minimal helloworld application.
    from wheezy.http import HTTPResponse
    from wheezy.http import WSGIApplication
    from wheezy.routing import url
    from wheezy.web.handlers import BaseHandler
    from wheezy.web.middleware import bootstrap_defaults
    from wheezy.web.middleware import path_routing_middleware_factory
    class WelcomeHandler(BaseHandler):
        def get(self):
            response = HTTPResponse()
            response.write('Hello World!1<br><a href="/welcome">welcome</a>')
            return response
    def welcome(request):
        response = HTTPResponse()
        response.write('Hello World!2')
        return response
    all_urls = [
        url('', WelcomeHandler, name='default'),
        url('welcome', welcome, name='welcome')
    options = {}
    main = WSGIApplication(
    if __name__ == '__main__':
        from wsgiref.simple_server import make_server
            print('Visit http://localhost:80/')
            make_server('', 80, main).serve_forever()
        except KeyboardInterrupt:

    but not work, apache report:


    You don't have permission to access /proba/ on this server. Apache/2.4.10 (Debian) Server at Port 80

    Any idea?

  2. damufo reporter

    Hi, Another test. Apache, enable site: WSGIScriptAlias /proba /home/proba/probaweb/hello.wsgi <Directory "/home/proba/probaweb"> Require all granted </Directory>

    I add file /home/proba/probaweb/hello.wsgi


    -- coding: utf-8 -*

    import os, sys


    def application(environ, start_response): from hello
    output = hello.welcome() start_response('200 OK', [('Content-Type', 'text/html; charset=utf-8')])

    return output


    In /home/proba/probaweb/ is also

    Now apache return 500 Internal Server Error

  3. damufo reporter


    nano /etc/apache2/sites-enabled/000-default.conf

    <VirtualHost *:80>
            ServerAdmin webmaster@localhost
            DocumentRoot /var/www/html
            WSGIDaemonProcess proba user=www-data group=www-data \
             processes=2 threads=15 display-name=%{GROUP}
            WSGIProcessGroup proba
            WSGIScriptAlias /proba /home/www-data/probaweb/
            WSGIPassAuthorization On
            <Directory "/home/www-data/probaweb">
              AllowOverride None
                Require all granted

    File /home/www-data/probaweb/

    import os
    import sys
    home = '/home/www-data/'
    sys.path.append(home + 'probaweb')
    os.chdir(home + 'probaweb')
    from hello import main
    def application(environ, start_response):
        environ['SCRIPT_NAME'] = ''
        return main(environ, start_response)

    and file /home/www-data/probaweb/

  4. Log in to comment