Skip to content

Instantly share code, notes, and snippets.

@nus
Created August 19, 2011 10:57
Show Gist options
  • Save nus/1156573 to your computer and use it in GitHub Desktop.
Save nus/1156573 to your computer and use it in GitHub Desktop.
make web2py-for-fluxflex
#!/usr/bin/bash
mkdir web2py-for-fluxflex
cd web2py-for-fluxflex
wget http://www.web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
rm web2py_src.zip
# Get web2py logo and rename web2py_logo.png.
# For using fluxflex application logo.
# Rename folder name for fluxflex.
mv web2py public_html
# .htaccess file
cat << EOF > public_html/.htaccess
RewriteEngine On
AddHandler fcgid-script .fcgi
RewriteBase /
RewriteRule ^dispatch\.fcgi/ - [L]
RewriteRule ^(.*)$ dispatch.fcgi/\$1 [QSA,L]
EOF
# fluxflex setting file
cat << EOF > .flx
[permission]
public_html/dispatch.fcgi 775
# Replace admin password with Database password.
# tmp_db_pw will be removed when deploy.
[replace]
tmp_db_pw DUMMY_DB_PASSWORD DB_PASSWORD
[deploy]
python -c "import os; os.chdir('./public_html'); from gluon.widget import console;console();"
python -c "p=open('tmp_db_pw', 'r').readline()[:-1]; import os; os.chdir('./public_html'); from gluon.main import save_password; save_password(p, 443)"
rm tmp_db_pw
EOF
# dummy password file
echo 'DUMMY_DB_PASSWORD' > tmp_db_pw
cat << EOF > public_html/dispatch.fcgi
#!/usr/bin/env python
import os
import sys
from gluon.main import wsgibase
import gluon.contrib.gateways.fcgi
from gluon.contrib.gateways.fcgi import WSGIServer
if __name__ == '__main__':
WSGIServer(wsgibase).run()
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment