on i4PACE(i for Personal Archiving and Creating Environment)
actions » SearchLogin 89 articles • 30 Jul 2010

Recent articles in 'python'

Wednesday, 16 Dec 2009

permalink silva

going to try silva (http://svn.infrae.com/). REAME.txt is here. will be back.

• Wrote Teru at 08:21 | read 28× | 0 Comments

Tuesday, 15 Dec 2009

permalink cyn.in

found cyn.in. started to try to install it on Ubuntu9.10.

page for downloading is http://www.cynapse.com/downloads/cynin-community-edition: community edition is here. its source code is available here. how to cyn.in build quick start is here.

oh, it's for 32bit x86, and the computer i'm using is 64bit AMD... will continue when i find a server i can work on. (note: later found it's only for pre-built iso version as pointed by Dhiraj Gupta in comment. if installed from source, cyn.in can be installed on 64bit CPU machines.)

ok. i found an 32bit x86 server (with Intel Cerelon 3GHz, 1GB RAM). downloaded cynin-ce-31-8-i386-10.iso at http://www.cynapse.com/downloads/cynin-community-edition, and burned it on a CD-R. booted the server with the CD. installing Debian and Cyn.in starts, and end in half an hour or so.

access the site from a PC on the same LAN as http://192.168.1.4/. the first page looks like this: [[image: cynin.png]]
kina cute :-) but... what is the default username and password... found at README.txt in /home/cynin/buildout that the username is admin and its password is secret. now, after logging in, the following page is shown: [[image: cynin3.png]]

it's already shown in Japanese, at least partially :-) found some words and word orders are pretty funny... perhaps automatic translation is used? quality of automatic translation of English to Japanese is still less than acceptable for general readers without re-editing/proofreading. i will be able to modify them when i find a way to translate it.

by the way, https://192.168.1.4:10000/ shows a Webmin page: [[image: cynin1.png]]
login as root leads to: [[image: cynin2.png]]

• Wrote Teru at 20:58 (edited 8×, last on 27 Dec 2009) | read 323× | 2 Comments

Friday, 21 Aug 2009

permalink Pytyrant

Pytyrant is a client for Tokyo Tyrant. Downloaded from here, untar and did

> sudo python setup.py install

The example code in pytyrant.py worked. Using this, I can write a Python code to manipulate Tokyo Cabinet databases.

• Wrote Teru at 15:32 | read 29× | 0 Comments

Tuesday, 14 Apr 2009

permalink web2py 4

Working with web2py on a server turns out to be troublesome. Because applications often suppose admin operations are performed on a local server. Moreover, the assumption goes into the core of web2py codes in some cases. For example, when inserting data to a database in appadmin of an application, a dialog box shows a selection of folders and files, not of the server, but of the client computer on the LAN. I don't know how to fix it without touching the code in web2py.

My current position is not a developer, but a user. So, avoiding the trouble, I'm going to install a desktop upon server, to do administration work on the local server. This page explains how to install Japanese desktop on an Ubuntu server. Following the instructions, add the repository as

wget -q https://www.ubuntulinux.jp/ubuntu-ja-archive-keyring.gpg -O- | sudo apt-key add -
sudo wget https://www.ubuntulinux.jp/sources.list.d/intrepid.list -O /etc/apt/sources.list.d/ubuntu-ja.list
sudo apt-get update

Upgrade

sudo apt-get upgrade

Install desktop

sudo apt-get install ubuntu-desktop

To create the remixed Japanese version,

sudo apt-get install ubuntu-desktop-ja

.

• Wrote Teru at 20:07 (edited 4×, last on 19 Apr 2009) | read 38× | 2 Comments

Wednesday, 08 Apr 2009

permalink web2py 3

So far, successfully ran web2py locally, then ran it on a local server over LAN and actually over Internet thru a reverse proxy server. The access as an administrator, however, was restricted only to localhost. By enabling https connection, I could access to admin on a server over LAN. When installed some applicances, KPAX CMS was OK, but JobSite had a problem, i.e., I couldn't see the database... It was available when connectind thru a local host. Maybe, it's because the application is not configured to be accessed thru an https connection, I wonder. I'm not sure.

Meanwhile, I found another way to access to admin thru a tunneled ssh here. I didn't know the use of ssh this way before. Surely worth trying. Supposedly JobSite shouldn't cause a problem because it's equivalent to connecting from a localhost.

Yes, it works! JobSite's admin is working correctly :->

• Wrote Teru at 21:45 (edited 2×, last on 08 Apr 2009) | read 24× | 0 Comments

Monday, 06 Apr 2009

permalink web2py 2

have run web2py on a local desktop, and now try to install on a local server.

Downlod the source from here.

$ cd web2py-read-only
$ python web2py -help

gives me

Usage: python web2py.py

web2py Web Framework startup script.  ATTENTION: unless a password is
specified (-a 'passwd') web2py will attempt to run a GUI. In this case command
line options are ignored.

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -i IP, --ip=IP        the ip address of the server (127.0.0.1)
  -p PORT, --port=PORT  the port for of server (8000)
  -a PASSWORD, --password=PASSWORD
                        the password to be used for administration (use -a
                        "<recycle>" to reuse the last password))
  -u UPGRADE, --upgrade=UPGRADE
                        upgrade applications
  -c SSL_CERTIFICATE, --ssl_certificate=SSL_CERTIFICATE
                        file that contains ssl certificate
  -k SSL_PRIVATE_KEY, --ssl_private_key=SSL_PRIVATE_KEY
                        file that contains ssl private key
  -d PID_FILENAME, --pid_filename=PID_FILENAME
                        file where to store the pid of the server
  -l LOG_FILENAME, --log_filename=LOG_FILENAME
                        file where to log connections
  -n NUMTHREADS, --numthreads=NUMTHREADS
                        number of threads
  -s SERVER_NAME, --server_name=SERVER_NAME
                        the server name for the web server
  -q REQUEST_QUEUE_SIZE, --request_queue_size=REQUEST_QUEUE_SIZE
                        max number of queued requests when server unavailable
  -o TIMEOUT, --timeout=TIMEOUT
                        timeout for individual request
  -z SHUTDOWN_TIMEOUT, --shutdown_timeout=SHUTDOWN_TIMEOUT
                        timeout on shutdown of server
  -f FOLDER, --folder=FOLDER
                        the folder where to run web2py
  -v, --verbose         increase --test verbosity
  -Q, --quiet           disable all output
  -D DEBUGLEVEL, --debug=DEBUGLEVEL
                        set debug output level (0-100, 0 means all, 100 means
                        none, default is 30)
  -S APPNAME, --shell=APPNAME
                        run web2py in interactive shell or IPython(if
                        installed) with specified appname
  -P, --plain           only use plain python shell, should be used with
                        --shell option
  -M, --import_models   auto import model files, default is False, should be
                        used with --shell option
  -R PYTHON_FILE, --run=PYTHON_FILE
                        run PYTHON_FILE in web2py environment, should be used
                        with --shell option
  -T TEST_PATH, --test=TEST_PATH
                        run doctests in web2py environment, TEST_PATH like
                        a/c/f (c,f optional)
  -W WINSERVICE, --winservice=WINSERVICE
                        -W install|start|stop as windows service
  -C, --cron            trigger a cron run manually, usually invoked from a
                        system crontab
  -N, --no-cron         Do not start cron automatically
  -L CONFIG, --config=CONFIG
                        Config file
  -F PROFILER_FILENAME, --profiler=PROFILER_FILENAME
                        profiler filename
  -t, --taskbar         Use web2py gui and run in taskbar (system tray)

Run the server as

$ python web2py --ip=192.168.1.81 --port=8801 --password=******

where ****** is a password. To make it secure, rerun it in the background as

$ python web2py --ip=192.168.1.81 --port=8801 --password="<recycle>" &

where "<recycle>" spacifies the password used last time. Open a browser on a desktop computer connected thru LAN, and wow :-D
[[image: web2py_on_server.png]]
It worked so easily. Thanks Massimo for making this excellent software ^_^

Now, when I click the link "click here for the administrative interface" on the page, I get a message on a browser:

Admin is disabled because unsecure channel


Ooops, what's wrong? Checked the archive of GoogleGroup web2py Web Framework, and found a comment by Massimo: "... admin and appadmin only work from localhost and remotely via ssl (ssh tunnel or https is enabled) " OK, some work to do. Looked at Deployment Recipes in a manual for web2py. Hmm, seems a lot of work to run behind Apache...

Seek a minimal requirement to let me access to admin thru LAN here. I.e., get a ssl certificate and a ssl private key as options for running web2py. Found a page for Creating Certificate Authorities and self-signed SSL certificates. Follow the instructions to create a self-signed certificate.

$ sudo su
$ cd /etc/ssl
$ mkdir self_signed
$ chown root.ssl-cert self_signe
$ chmod 7
$ cd /etc/ssl/self_signed
$ chown root.ssl-cert self_sign
$ openssl genrsa -des3 -out server.key 4096

Typed a pass phrase when asked.

$ openssl req -new -key server.key -out server.csr

then

Country Name (2 letter code) [AU]:JA
State or Province Name (full name) [Some-State]:Yamagata
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:YUI Limited Partnership   
Organizational Unit Name (eg, section) []:                        
Common Name (eg, YOUR name) []:web2py.emedia.jp
Email Address []:xxxxxxx@gmail.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

For signing the certificate signing request,

$  openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
Signature ok
subject=/C=JA/ST=Yamagata/O=ip/CN=web2py.emedia.jp/emailAddress=xxxxxxx@gmail.com
Getting Private key
Enter pass phrase for server.key:******

Create a version without password.

$ openssl rsa -in server.key -out server.key.insecure
Enter pass phrase for server.key:******
writing RSA key

$ mv server.key server.key.secure
$ mv server.key.insecure server.key

Now accessing http://192.168.1.81:8801/ from a browser at a desktop gives [[image: web2py_server_1.png]]
Oops %-|
Changed to http://192.168.1.81:8801/ gives
[[image: web2py_server_2.png]]
Hitting to accept it,
[[image: web2py_server_3.png]]
Jump to the link " click here for the administrative interface", then
[[image: web2py_server_4.png]]
After typing the password, get [[image: web2py_server_5.png]]

OK. Ready to run appliances/applications! :-D
Later, will need to daemonize the start of the server with the script providec as ./scripts/web2py.ubuntu.sh. To deploy in production, will need to run web2py as an wsgi application on Apache.

• Wrote Teru at 08:09 (edited 10×, last on 04 Dec 2009) | read 862× | 0 Comments

Thursday, 19 Feb 2009

permalink web2py

Download the source code from here. Unzip web2p.zip. At terminal,

$ python web2py.py

returns

unpacking apps, this may take a few minutes...
default applications are now installed
web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2009
Version 1.56.3 (2009-02-16 10:07:09)
Database drivers available: SQLite3

and a new window
[[image: web2py_server.png]]
Type a password in and push "start server" button.
[[image: web2py_start_server_1.png]]
Push "OK"
[[image: web2py_start_server_2.png]]
is shown on a browser. Click [click here for the administrative interface].
[[image: web2py_start_server_4.png]]
Type the password, and push 実行 button.
[[image: web2py_start_server_5.png]]

Downloaded an application KPAX CMS, and uploaded with a name Kpax. [[image: web2py_start_server_7.png]]
Hit the Kpax link.
[[image: web2py_start_server_8.png]]
Register a user and login.
[[image: web2py_start_server_9.png]]
Looks good... but, how am I going to edit the site? Go back to http://127.0.0.1:8000/admin/default/site, and hit "design" under Kpax.
[[image: web2py_kpax_1.png]]

• Wrote Teru at 12:55 (edited 5×, last on 19 Feb 2009) | read 34× | 0 Comments

Monday, 01 Dec 2008

permalink Pinax deployment using mod_wsgi

Try to run Pinax using mod_wsgi.

Use the exemple ~/pinax/projects/complete_project/deploy/complete_project.wsgi. Create an Apache2 configuration file pinax_complete_project_site at /etc/apache2/sites-available as follows:

WSGIScriptAlias / /home/yarrow/pinax/projects/complete_project/deploy/complete_project.wsgi
WSGIDaemonProcess complete_project user=yarrow group=yarrow threads=25
WSGIProcessGroup complete_project

Alias /media/ /var/lib/python-support/python2.5/django/contrib/admin/media/
<Directory /var/lib/python-support/python2.5/django/contrib/admin/media>
Order deny,allow
Options Indexes
Allow from all
IndexOptions FancyIndexing
</Directory>

Alias /site_media/ /home/yarrow/pinax/projects/complete_project/site_media/
<Directory /home/yarrow/pinax/projects/complete_project/media>
Order deny,allow
Allow from all
</Directory>

<Directory /home/yarrow/pinax/projects/complete_project/deploy>
Order deny,allow
Allow from all
</Directory>

Load the file by

$ sudo a2ensite pinax_complete_project_site

Rerun

$ python manage.py syncdb

Run Apache by

$ sudo /etc/init.d/apache2 start

Got errors. Modified settings.py: The line

DATABASE_NAME = 'dev.db'

is changed to

basepath = os.path.dirname(__file__)
DATABASE_NAME = os.path.join(basepath, 'database.sqlite')

or, according to a tip on pinax-user,

DATABASE_NAME = PROJECT_ROOT + '/dev.db'

'dev.db' worked for me.

Rerun manage.py and apache2.

OK, it worked :-)

Added the following code at the top of /etc/apache2/sites-available/pinax_complete_project_site

# Don't expose .svn files/directories    
<DirectoryMatch "^/.*/\.svn/">
    Order deny,allow
    Deny from all
</DirectoryMatch>

References:

  1. http://pinaxproject.com/docs/trunk/deployment.html
  2. http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
  3. http://it.kndb.jp/entry/show/id/2370
• Wrote Teru at 12:05 (edited 4×, last on 01 Dec 2008) | read 626× | 1 Comments

Tuesday, 25 Nov 2008

permalink Building up Pinax Documents by Sphinx

When checked docs directory in the Pinax source, found it uses Sphinx-build, which was not listed in the Ubuntu repository somehow. Sphinx site suggests to use

$ easy_install Sphinx

Now, where is easy_install? Turned out it's in python-setuptools. Installed it by

$ sudo apt-get install python-setuptools

OK, install Sphinx

$ sudo easy_install Sphinx

Wow, it's downloading and installing... but, failed:

INFORMATION the speedup extension could not be compiled, Jinja will fall back to the native python classes. =============================================================================== error: Setup script exited with error: can't copy 'Jinja.egg-info/native_libs.txt': doesn't exist or not a regular file

Hmm... well, install

$ sudo apt-get install python-jinja

and ran again

$ sudo easy_install Sphinx

OK, it worked :-> So, ran Sphinx as

$ cd ~/pinax/docs
$ make htmlhelp

Ah, great automation... with one warning

build succeeded, 1 warning.

and says

Build finished; now you can run HTML Help Workshop with the .hhp project file in .build/htmlhelp.

Doing

$ cd .build/htmlhelp
$ firefox index.html

showed
[[image: pinax_doc.png]]
Good :-) Still a lot to read :-/

http://pinaxproject.com/docs/trunk/ provides the same pages.

• Wrote Teru at 15:43 (edited 5×, last on 25 Nov 2008) | read 30× | 0 Comments

Monday, 17 Nov 2008

permalink Japanese translation of Pinax 3

Getting better.

Modified the template ~/pinax/projects/complete_project/templates/projects/project.html to add two blocktrans sections. After running

$  python /var/lib/python-support/python2.5/django/bin/django-admin.py makemessages -l ja

new msgid/msgstr pairs appeared in django.po. I translated them and run

$  python /var/lib/python-support/python2.5/django/bin/django-admin.py compilemessages

and ran the server by

$ python manage.py runserver 192.168.1.81:8000 &

But, the new translation parts were not reflected on the page :-/ disappointing. (Later it worked after some tweaking. Dec.4, 2008)

Found django.po files under ~/pinax/apps/external_apps. I translated them, and created django.mo. How about other apps? Opened SciTE editor and searched with a keyword _(. Well, a lot ! So, realize I need to learn more about how the whole translation works here in this Pinax project. Posted on pinax-users mailing list at http://groups.google.com/group/pinax-users. No reply yet. (Have received responses. Good help. Dec.4, 2008)

• Wrote Teru at 18:36 (edited 3×, last on 04 Dec 2008) | read 29× | 1 Comments

10 shown; more articles may be found in the archives. The permalink icon is the article's permalink.
Process times: page=0.227 request=0.235 cpu=0.240