diff --git a/README.md b/README.md index 5b4f89dc0337376e76793a9300be0186c578b1b1..e9e1490dd522baf7ff1778a998f24e8f49c9cce1 100644 --- a/README.md +++ b/README.md @@ -7,49 +7,67 @@ Especially useful for events. Dependencies ------------ - * python-flask python-genshi python-pythonmagick + * python-flask python-genshi + * python-pythonmagick + graphicsmagick * pdflatex latex-beamer * libapache2-mod-wsgi for production use (or [anything capable of running WSGI apps](http://wsgi.readthedocs.org/en/latest/servers.html) really…) + +Download +-------- + + $ git clone https://github.com/kif-ev/schildergenerator.git + + Config ------ - * copy config.py.example to config.py and edit it to your needs. - * copy schildergen.wsgi.example to schildergen.wsgi and edit it. + * for all uses: copy config.py.example to config.py and edit it to your needs. + * for production use: copy schildergen.wsgi.example to schildergen.wsgi and edit it. -Apache Config -------------- +Running in test/debug mode +-------------------------- + +You need to have the config done. Then you could just start the server in debug mode: + + $ python schilder.py + + +Webserver Deployment +-------------------- + +See http://flask.pocoo.org/docs/0.10/deploying/ for all deployment options. + +Example config for the Apache Webserver, following http://flask.pocoo.org/docs/deploying/mod_wsgi/: + + LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so + WSGIRestrictStdout Off + + <VirtualHost *:443> + ServerAdmin admin@server.test + DocumentRoot /path/to/schildergen + ServerName server.name.org + AddDefaultCharset utf-8 + ErrorLog /path/to/log + CustomLog /path/to/log + + SSLEngine on + SSLCertificateFile /path/to/www.example.com.cert + SSLCertificateKeyFile /path/to/www.example.com.key + + WSGIDaemonProcess schildergen user=www-data group=www-data threads=2 + WSGIScriptAlias / /path/to/schildergen.wsgi -See also http://flask.pocoo.org/docs/deploying/mod_wsgi/ - -LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so -WSGIRestrictStdout Off - - <VirtualHost *:443> - ServerAdmin admin@server.test - DocumentRoot /path/to/schildergen - ServerName server.name.org - AddDefaultCharset utf-8 - ErrorLog /path/to/log - CustomLog /path/to/log - - SSLEngine on - SSLCertificateFile /path/to/www.example.com.cert - SSLCertificateKeyFile /path/to/www.example.com.key - - WSGIDaemonProcess schildergen user=www-data group=www-data threads=2 - WSGIScriptAlias / /path/to/schildergen.wsgi - - <Directory /path/to/schildergen.wsgi> - AllowOverride All - WSGIProcessGroup schildergen - WSGIApplicationGroup %{GLOBAL} - WSGIScriptReloading On - Order deny,allow - Allow from all - </Directory> - </VirtualHost> + <Directory /path/to/schildergen.wsgi> + AllowOverride All + WSGIProcessGroup schildergen + WSGIApplicationGroup %{GLOBAL} + WSGIScriptReloading On + Order deny,allow + Allow from all + </Directory> + </VirtualHost> Contributors ============ diff --git a/data/GenericEvent42-1331353749.schild b/data/GenericEvent42-1331353749.schild index dc15a02ef2992d593e510a2a70518ad5bb5e0e58..751fd5fbab81c65b9d2545ff75b3120758af3d48 100644 --- a/data/GenericEvent42-1331353749.schild +++ b/data/GenericEvent42-1331353749.schild @@ -1 +1 @@ -{"pdfname": "GenericEvent42-1331353749.schild.pdf", "img": "pictograms-nps-misc-camera.png", "headline": "Generic\r\nEvent42", "text": "Man kann Wiki-Syntax benutzen.\r\n\r\n* Zum Beispiel f\u00fcr\r\n\r\n* Bullet Lists", "markup": "latex", "reusefilename": "on", "textemplate": "image-left_bothtext-right.tex", "filename": "GenericEvent42-1331353749.schild"} \ No newline at end of file +{"pdfname": "GenericEvent42-1331353749.schild.pdf", "img": "pictograms-nps-misc-camera.png", "headline": "Generic\r\nEvent42", "text": "Man kann Wiki-Syntax benutzen.\r\n\r\n* Zum Beispiel f\u00fcr\r\n* Bullet Lists\r\n", "markup": "rst", "reusefilename": "on", "textemplate": "image-left_bothtext-right.tex", "filename": "GenericEvent42-1331353749.schild"} \ No newline at end of file diff --git a/data/GenericEvent42-1545270496.schild b/data/GenericEvent42-1545270496.schild new file mode 100644 index 0000000000000000000000000000000000000000..aaf74cbae7ef9d3716e6e9813d093920ea7fdc54 --- /dev/null +++ b/data/GenericEvent42-1545270496.schild @@ -0,0 +1 @@ +{"img": "pictograms-nps-parking-2.png", "headline": "GenericEvent42", "text": "", "markup": "latex", "textemplate": "headline-top_arrowup_image-right.tex", "filename": "GenericEvent42-1545270496.schild", "pdfname": "GenericEvent42-1545270496.schild.pdf", "reusefilename": ""} \ No newline at end of file diff --git a/data/Generic_Event_42897947894.schild b/data/Generic_Event_42897947894.schild deleted file mode 100644 index be38e6652c2a005af664891f09cdeb0f27ce347d..0000000000000000000000000000000000000000 --- a/data/Generic_Event_42897947894.schild +++ /dev/null @@ -1 +0,0 @@ -{"pdfname": "Generic_Event_42897947894.schild.pdf", "img": "pictograms-nps-parking-2.png", "headline": "GenericEvent42", "text": "", "markup": "rst", "reusefilename": "on", "textemplate": "headline-top_arrowup_image-right.tex", "filename": "Generic_Event_42897947894.schild"} \ No newline at end of file diff --git a/schilder.py b/schilder.py index f0c09de6d38bdea96ea8bb409723f436c45b16e0..9efca74115abdb78a7a9b2100019ea6377595320 100755 --- a/schilder.py +++ b/schilder.py @@ -22,8 +22,11 @@ import tempfile import config app = Flask(__name__) -app.config['UPLOAD_FOLDER'] = config.uploaddir -app.config['PROPAGATE_EXCEPTIONS'] = True +app.config.update( + UPLOAD_FOLDER = config.uploaddir, + PROPAGATE_EXCEPTIONS = True, + MAX_CONTENT_LENGTH = 8388608L +) app.secret_key = config.app_secret genshi = Genshi(app) genshi.extensions['html'] = 'html5' @@ -92,8 +95,8 @@ def run_pdflatex(context, outputfilename, overwrite=True): tmpdir = tempfile.mkdtemp(dir=config.tmpdir) if context.has_key('img') and context['img'] and context['img'] != '__none': try: - shutil.copy(os.path.join(config.imagedir, context[ - 'img']), os.path.join(tmpdir, context['img'])) + shutil.copy(os.path.join(config.imagedir, context['img']), + os.path.join(tmpdir, context['img'])) except: raise IOError("COULD NOT COPY") else: diff --git a/templates/edit.html b/templates/edit.html index e54062f7681e0a52d47c09ae0d84b323af46a0b4..24d87148f720462f77ddd436380d8d8ae07edc34 100644 --- a/templates/edit.html +++ b/templates/edit.html @@ -20,7 +20,7 @@ <ul py:attrs="{'class':'collapsed'} if defined('form') else {}"> <li py:for="textemplate in templates"> <input type="radio" name="textemplate" id="tpl:${textemplate}" value="${textemplate}" py:attrs="{'checked':'checked', 'onfocus':'this.parentElement.parentElement.className=\'\';'} if defined('form') and textemplate == form.textemplate else {}"/> - <label for="tpl:${textemplate}"><img src="${ url_for('tplthumbnail', tplname=textemplate, maxgeometry=72) }" alt="${textemplate}" title="${textemplate}"/></label> + <label for="tpl:${textemplate}"><img src="${ url_for('tplthumbnail', tplname=textemplate, maxgeometry=80) }" alt="${textemplate}" title="${textemplate}"/></label> </li> <li class="onlywhencollapsed"> <button onclick="this.parentElement.parentElement.className=''; return false;" >Auswahl anzeigen</button>