Helmut Pozimski a35079b144 add cyber_generator script 8 vuotta sitten
..
README.md a35079b144 add cyber_generator script 8 vuotta sitten
impressum.py a35079b144 add cyber_generator script 8 vuotta sitten
index.py a35079b144 add cyber_generator script 8 vuotta sitten

README.md

About

The "cyber generator" is a little wsgi script I have written to make myself familiar with wsgi python in general and because I was a bit pissed off because of the most of the time meaningless use of the word cyber so it can be seen as a kind of protest. It takes a random noun from a dictionary that is provided as an sqlite database, adds the prefix "cyber" to it and displays it on a web site along with some explaining words. Currently it does all this in German. An example of the generated web site can be seen at cyber-everything.de.

Setting up

You will first need an sqlite database with a single table named "wordlist" and two columns "word" and "used". The "word" coulmn has to be prepopulated with words from the desired language. Since I am not sure about the legal implications, I don't provide a prepopulated database file. It should however be relatively easy to get one of the publicly available dictionaries and dump all the nouns into the database.

The second step is to place all files in the document root on your web server. It is important that the user that is used as the "identity" of the web server (usually www-data) is able to write into the directory and also can write into the sqlite database. Once this is done, activate mod_wsgi and create a vhost configuration for the new site. The wsgi part could look like this:

    WSGIScriptAlias /impressum /var/www/impressum.py
    WSGIScriptAlias / /var/www/index.py
    WSGIDaemonProcess cyber-everything processes=1 threads=1 display-name=%{GROUP}
    WSGIProcessGroup cyber-everything

This assumes that your document root is "/var/www", in reality it would most likely be different, please adapt to your needs. Thie file "index.py" is the main page that does the actual generation. The "impressum.py" is a more or less static sub-page that shows an imprint as required by German law. If these laws don't apply to you, you can just skip this part and remove the "Impressum" link from index.py.

That's it. You now should have a simple cyber generator running at the (sub)domain you configured in the apache vhost.