Skip to content

Instantly share code, notes, and snippets.

@MaxMorais
Created October 27, 2013 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaxMorais/7187526 to your computer and use it in GitHub Desktop.
Save MaxMorais/7187526 to your computer and use it in GitHub Desktop.
2 ways to setup ERPNext with Apache and WSGI
Listen 8080
NameVirtualHost *:8080
<VirtualHosst *:8080>
ServerName localhost
# you ERPNext folder
DocumentRoot /var/www/erpnext/public
AddHandler cgi-script .cgi .xml .py
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/x-font-woff .woff
<Directory /var/www/erpnext/public/>
# directory specific options
Options -Indexes +FollowSymLinks +ExecCGI
# directory's index file
DirectoryIndex CGIHandler.py
AllowOverride all
Order Allow,Deny
Allow from all
# rewrite rule
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([^/]+)$ CGIHandler.py?page=$1 [QSA,L]
</Directory>
</VirtualHost>
Listen 8080
NameVirtualHost *:8080
<VirtualHosst *:8080>
ServerName localhost
# you ERPNext folder
DocumentRoot /var/www/erpnext/public
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/x-font-woff .woff
WSGIDaemonProcess erpnext user=erṕnext group=erpnexy threads=5
WSGIScriptAlias / /var/www/erpnext/public/WSGIHandler.wsgi
<Directory /var/www/erpnext/public/>
WSGIProcessGroup yourapplication
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
#!/usr/bin/env python
import sys, os
sys.path.append(os.path.abspath(
os.path.join(
os.path.dirname(__file__),
'..'
)
)
)
from wsgiref import CGIHandler
from lib.webnotes.app import application
if __name__ == '__main__':
CGIHandler().run(application)
#!/usr/bin/env python
import sys, os
sys.path.append(os.path.abspath(
os.path.join(
os.path.dirname(__file__),
'..'
)
)
)
from lib.webnotes.app import application
if __name__ == '__main__':
application.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment