some cleanup and refactoring
This commit is contained in:
parent
0c4fed2a2b
commit
fcd783ef26
7 changed files with 32 additions and 9 deletions
|
@ -21,6 +21,8 @@
|
||||||
ErrorLog ${APACHE_LOG_DIR}/reminder.pimux.de_error.log
|
ErrorLog ${APACHE_LOG_DIR}/reminder.pimux.de_error.log
|
||||||
CustomLog ${APACHE_LOG_DIR}/reminder.pimux.de_access.log combined
|
CustomLog ${APACHE_LOG_DIR}/reminder.pimux.de_access.log combined
|
||||||
|
|
||||||
|
SetEnv SECRET_KEY secret
|
||||||
|
|
||||||
WSGIDaemonProcess reminder user=www-data group=www-data threads=5
|
WSGIDaemonProcess reminder user=www-data group=www-data threads=5
|
||||||
WSGIScriptAlias / /var/www/vhosts/reminder.pimux.de/index.py
|
WSGIScriptAlias / /var/www/vhosts/reminder.pimux.de/index.py
|
||||||
WSGIScriptReloading On
|
WSGIScriptReloading On
|
||||||
|
|
13
app/__init__.py
Normal file
13
app/__init__.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
from flask import Flask
|
||||||
|
from flask_wtf.csrf import CSRFProtect
|
||||||
|
from app.index import index
|
||||||
|
|
||||||
|
cp = CSRFProtect()
|
||||||
|
|
||||||
|
|
||||||
|
def create_app():
|
||||||
|
app = Flask(__name__)
|
||||||
|
app.config['SECRET_KEY'] = 'SECRET_KEY'
|
||||||
|
app.register_blueprint(index)
|
||||||
|
cp.init_app(app)
|
||||||
|
return app
|
BIN
app/__init__.pyc
Normal file
BIN
app/__init__.pyc
Normal file
Binary file not shown.
|
@ -1,17 +1,15 @@
|
||||||
from flask import Flask, render_template, request, send_file
|
from flask import Blueprint, render_template, send_file
|
||||||
from icalendar import Calendar, Alarm
|
from icalendar import Calendar, Alarm
|
||||||
from flask_wtf import FlaskForm
|
from flask_wtf import FlaskForm
|
||||||
#from flask_wtf.file import FileField, FileRequired
|
from flask_wtf.file import FileField, FileRequired
|
||||||
from wtforms import FileField, IntegerField, SubmitField
|
from wtforms import IntegerField, SubmitField
|
||||||
from wtforms.validators import InputRequired
|
|
||||||
from wtforms.widgets.html5 import NumberInput
|
from wtforms.widgets.html5 import NumberInput
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
application = Flask(__name__)
|
index = Blueprint('index', __name__, template_folder='templates')
|
||||||
application.config['SECRET_KEY'] = 'secret'
|
|
||||||
|
|
||||||
|
|
||||||
@application.route("/", methods=['GET', 'POST'])
|
@index.route("/", methods=['GET', 'POST'])
|
||||||
def addreminder():
|
def addreminder():
|
||||||
form = IcsForm()
|
form = IcsForm()
|
||||||
content = render_template('index.html', form=form)
|
content = render_template('index.html', form=form)
|
||||||
|
@ -49,7 +47,7 @@ def addreminder():
|
||||||
|
|
||||||
|
|
||||||
class IcsForm(FlaskForm):
|
class IcsForm(FlaskForm):
|
||||||
icsfile = FileField('ICS File', validators=[InputRequired()])
|
icsfile = FileField('ICS File', validators=[FileRequired()])
|
||||||
hours = IntegerField('Hours', default=0,
|
hours = IntegerField('Hours', default=0,
|
||||||
widget=NumberInput(step=1, min=0, max=24))
|
widget=NumberInput(step=1, min=0, max=24))
|
||||||
minutes = IntegerField('Minutes', default=0,
|
minutes = IntegerField('Minutes', default=0,
|
|
@ -14,7 +14,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</main>
|
</main>
|
||||||
<footer>
|
<footer>
|
||||||
<a href="https://github.com/Finn10111/caesar-chiffre">source code on github</a>
|
<a href="https://github.com/Finn10111/reminder">source code on github</a>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -3,6 +3,7 @@
|
||||||
<h1>Add reminders to ICS files</h1>
|
<h1>Add reminders to ICS files</h1>
|
||||||
<form method="POST" action="/" enctype=multipart/form-data>
|
<form method="POST" action="/" enctype=multipart/form-data>
|
||||||
<div class="form">
|
<div class="form">
|
||||||
|
{{ form.csrf_token }}
|
||||||
<ol>
|
<ol>
|
||||||
<li>Select ICS file</li>
|
<li>Select ICS file</li>
|
||||||
<li>Set reminder time</li>
|
<li>Set reminder time</li>
|
9
reminder.wsgi
Normal file
9
reminder.wsgi
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
sys.path.insert(1, os.path.dirname(__file__))
|
||||||
|
from app import create_app
|
||||||
|
|
||||||
|
def application(environ, start_response):
|
||||||
|
os.environ['SECRET_KEY'] = environ.get('SECRET_KEY')
|
||||||
|
app = create_app()
|
||||||
|
return app(environ, start_response)
|
Loading…
Reference in a new issue