|
Web2py is a Python web framework. - Install Python 2.5 or 2.6
- Install setuptools
- Run easy_install Flup
- Download and extract web2py
- Run python web2py.py to create the necessary framework files
- Create a file dispatch.fcgi at the root of web2py directory with the following content:
#!/home/youruserhere/run/bin/python import sys from flup.server.fcgi_fork import WSGIServer import gluon.main application=gluon.main.wsgibase ## or # application=gluon.main.wsgibase_with_logging WSGIServer(application).run()
- make this file executable by typing
-
- create or add the following lines to .htaccess:
RewriteEngine On RewriteBase / RewriteRule ^dispatch\.fcgi/ - [L] RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
Try and access the domain on your browser and work! Example: application "MD5 decode "
Also You will note that you will not be able to access the admin page unless you're using SSL. This is however easy to circumvent by editing /applications/admin/controllers/default.py and duplicating parameters_8000.py as parameters_80.py. But note that this is not recomended!!! For the database administration to work you will have to: edit the appadmin.py file of your application and remove the lines:
if request.env.remote_addr!=request.env.http_host.split(':')[0]: raise HTTP(400)
Tipsweb2py admin (ssl)Install Putty, you can get it here(http://www.chiark.greenend.org.uk/~sgtatham/putty/). Once installed, create a new session, type in the IP address of your server in the field named "Host Name". on the left side of the session list, there is a tree of settings, click on "SSH" and then "Tunnels". In the field "source port", type in 8000 (8000 in the case if you are running your remote web2py installation on its default port, otherwise adjust accordingly) and in the corresponding field called "Destination", type in "127.0.0.1:8001". The port value can be anything of your choice actually, I just like to count one number above the actual port number because its easier to remember. Before doing anything else, go to the top of the settings tree, click on "Sessions" again, then on the right side click on "save". If you need a tunnel lso for PostgreSQL, go back to "SSH-->Tunnels and repeat the process but using PostgreSQLs default port which is 5432. Dont forget to save the session after making changes! Be slick, fire up putty, choose the session you just saved, log in on the remote server and type in your browser "localhost:8001" |