nntp2http.com
Posting
Suche
Optionen
Hilfe & Kontakt

Suche Web hosting mit Python 2.6, PIL, ClearSilver, SQLite...

Von: Andreas Elliker (andreas.0901@elliker.ch) [Profil]
Datum: 01.11.2009 01:50
Message-ID: <hcim0d$jd2$1@news.eternal-september.org>
Newsgroup: de.comm.provider.webspace
Salut!

Ich suche web hosting zum Preis von <= EUR 20/Monat, wo
der unten eingefügte Beispielcode läuft.

Der verwendet folgende Software:

- Python >=2.6
http://www.python.org/

- ClearSilver >=0.10.5
http://www.clearsilver.net/

- Python Imaging Library (PIL) >=1.1.6
http://www.pythonware.com/products/pil/

- SQLite >=3.6.14.2 mit python interface
http://www.sqlite.org/
http://docs.python.org/library/sqlite3.html

Ich benötige zudem:

- cron jobs

- Eine Schnittstelle, um per Script E-Mail-Forwarder zu
verwalten, daher erstellen und löschen. Bei postfix
lässt sich evtl. mit aliases(5) was machen.

- sftp access

- Das Übliche: access log files, email accounts,
forwarder und aliases, POP3s, IMAPs, .htaccess, cgi,
https, SSL Zertifikat einstellen

- In Zukunft evtl. PostgreSQL mit Python-Modulen oder
auch Python 3

- >=1 GB Speicherplatz auf der HD

Beispielcode:

test.py
#v+
#!/usr/bin/env python2.6

import hashlib, os, sys, time  # Python Standard Library
import Image, neo_cgi, sqlite3 # external modules

connection = sqlite3.connect('test.db')
cursor = connection.cursor()

cursor.execute('CREATE TABLE IF NOT EXISTS \
test (hash STRING PRIMARY KEY, epoch INTEGER);')
connection.commit()

neo_cgi.cgiWrap(sys.stdin, sys.stdout, os.environ)
page = neo_cgi.CGI()
page.parse()

if page.hdf.getValue('Query.image', ''):
image = Image.open(page.filehandle('image'))
image.thumbnail((240, 240), Image.ANTIALIAS)
image.save('test.jpeg', 'JPEG')

with open('test.jpeg') as file:
hash = hashlib.sha256(file.read()).hexdigest()

cursor.execute('INSERT OR REPLACE INTO test \
(hash, epoch) VALUES (?, ?);', \
(hash, time.time()))
connection.commit()

cursor.execute('SELECT * FROM test;')
for row in cursor:
page.hdf.setValue('image', row[0])
page.hdf.setValue('image.' + row[0], str(row[1]))

page.display('test.html')
connection.close()
#v-

test.html
#v+
<h1>new</h1>
<form action="" method="post"
enctype="multipart/form-data">
<input type="file" name="image" />
<input type="submit" value="upload image and save hash value" />
</form>
<h1>last</h1>
<p><img src="test.jpeg" /></p>
<h1>previous</h1>
<dl>
<?cs each:item = image ?>
<dt><?cs name:item ?></dt><dd><?cs var:item ?></dd>
<?cs /each ?>
</dl>
#v-

Wo kriege ich solches web hosting?
Wo kriege ein ähnliches Angebot?

--
à dieu
Andreas

[ Auf dieses Posting antworten ]

Antworten