-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3cb605f
Showing
18 changed files
with
321 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cfg.yaml | ||
.env | ||
venv | ||
__pycashe__ | ||
database.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: gunicorn run:app |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
from flask import Flask, render_template, redirect, url_for | ||
from wtforms import StringField, SubmitField, PasswordField | ||
from wtforms.validators import InputRequired, Length | ||
from flask_wtf import FlaskForm | ||
from flask_bootstrap import Bootstrap | ||
from flask_sqlalchemy import SQLAlchemy | ||
import os | ||
from datetime import datetime | ||
import psycopg2 | ||
from yaml_data_cfg import sequenz | ||
|
||
|
||
|
||
|
||
app = Flask(__name__) | ||
Bootstrap(app) | ||
SECRET_KEY = os.urandom(32) | ||
app.config.from_object(os.environ['APP_SETTINGS']) | ||
app.config['SECRET_KEY'] = SECRET_KEY | ||
#app.config['SQLALCHEMY_DATABASE_URI'] = sequenz | ||
|
||
db = SQLAlchemy(app) | ||
|
||
|
||
|
||
|
||
class User(db.Model): | ||
__tablename__= 'SYSTEM' | ||
id=db.Column( db.Integer, primary_key = True) | ||
vorname = db.Column( db.String()) | ||
nachname = db.Column(db.String()) | ||
email = db.Column(db.String()) | ||
password = db.Column(db.String()) | ||
create_data = db.Column(db.DateTime, default=datetime.utcnow) | ||
|
||
|
||
|
||
def __init__(self, vorname, nachname, email, password): | ||
self.vorname = vorname | ||
self.nachname = nachname | ||
self.email = email | ||
self.password = password | ||
|
||
|
||
|
||
class Regester(FlaskForm): | ||
vorname = StringField('Vorname', validators=[InputRequired(), Length(max=10)]) | ||
nachname = StringField('Nachname', validators=[InputRequired(), Length(max=10)]) | ||
email = StringField('Email', validators=[InputRequired(), Length(max=200)]) | ||
password = PasswordField('Password', validators=[InputRequired(), Length(max=200)]) | ||
|
||
|
||
|
||
|
||
|
||
class Login(FlaskForm): | ||
email = StringField('Email', validators=[InputRequired(), Length(max=200)]) | ||
password = PasswordField('Password', validators=[InputRequired(), Length(max=200)]) | ||
submit = SubmitField('Regester') | ||
|
||
|
||
|
||
|
||
|
||
|
||
@app.route('/') | ||
def index(): | ||
return render_template('index.html') | ||
|
||
|
||
@app.route('/dashboard', methods=['POST', 'GET']) | ||
def office(): | ||
return render_template('office.html') | ||
|
||
|
||
|
||
|
||
@app.route('/log', methods=['POST', 'GET']) | ||
def user(): | ||
form = Login() | ||
if form.validate_on_submit(): | ||
user = User.query.filter_by(email=form.email.data).first() | ||
password = User.query.filter_by(password=form.password.data).first() | ||
if user: | ||
if password: | ||
return redirect(url_for('office')) | ||
else: | ||
return '<h1> The user is not exested<h1>' | ||
|
||
return render_template('log.html', form=form) | ||
|
||
|
||
|
||
|
||
|
||
@app.route('/regester', methods=['POST', 'GET']) | ||
def regist(): | ||
form = Regester() | ||
if form.validate_on_submit(): | ||
user = User( | ||
vorname = form.vorname.data, | ||
nachname = form.nachname.data, | ||
email= form.email.data, | ||
password = form.password.data | ||
) | ||
db.session.add(user) | ||
db.session.commit() | ||
|
||
return redirect(url_for('user')) | ||
|
||
return render_template('regester.html', form=form) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import os | ||
basedir = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
|
||
class Config(object): | ||
DEBUG = False | ||
TESTING = False | ||
CSRF_ENABLED = True | ||
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL'] | ||
|
||
|
||
class ProductionConfig(Config): | ||
DEBUG = False | ||
|
||
|
||
class StagingConfig(Config): | ||
DEVELOPMENT = True | ||
DEBUG = True | ||
|
||
|
||
class DevelopmentConfig(Config): | ||
DEVELOPMENT = True | ||
DEBUG = True | ||
|
||
|
||
class TestingConfig(Config): | ||
TESTING = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
bcrypt==3.2.0 | ||
cffi==1.15.0 | ||
click==8.0.4 | ||
dominate==2.6.0 | ||
Flask==2.0.3 | ||
Flask-Bcrypt==0.7.1 | ||
Flask-Bootstrap==3.3.7.1 | ||
Flask-Login==0.5.0 | ||
Flask-SQLAlchemy==2.5.1 | ||
Flask-WTF==1.0.0 | ||
gunicorn==20.1.0 | ||
itsdangerous==2.1.1 | ||
Jinja2==3.0.3 | ||
MarkupSafe==2.1.1 | ||
psycopg2==2.9.3 | ||
pycparser==2.21 | ||
PyYAML==6.0 | ||
six==1.16.0 | ||
SQLAlchemy==1.4.32 | ||
visitor==0.1.3 | ||
Werkzeug==2.0.3 | ||
WTForms==3.0.1 | ||
python-dotenv==0.19.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from app import app | ||
|
||
|
||
|
||
if __name__=="__main__": | ||
app.run(debug=True) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
{% block title %}{% endblock %} | ||
</head> | ||
<body> | ||
|
||
|
||
{% block body %}{% endblock %} | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{% extends "base.html" %} | ||
{% import "bootstrap/wtf.html" as wtf %} | ||
{{ wtf.quick_form(form) }} | ||
|
||
<!--{{ url_for('static', filename='css/')}}--> | ||
|
||
{% block head %} | ||
|
||
<link href="{{ url_for('static', filename='css/index.css')}}" rel="stylesheet"> | ||
{% endblock %} | ||
|
||
|
||
|
||
{% block body %} | ||
<div class="system"> | ||
<h1> Hallo von Homepage</h1> | ||
<a href="{{url_for('user')}}">Logn in</a> | ||
<a href="{{url_for('regist')}}"> Sign Up</a> | ||
</div> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{% extends "base.html" %} | ||
{% import "bootstrap/wtf.html" as wtf %} | ||
{{ wtf.quick_form(form) }} | ||
|
||
|
||
|
||
{% block head %} | ||
|
||
<link href="{{ url_for('static', filename='css/log.css')}}" rel="stylesheet"> | ||
{% endblock %} | ||
|
||
|
||
|
||
{% block body %} | ||
|
||
<form action="/log" method="post"> | ||
|
||
{{ form.hidden_tag() }} | ||
{{wtf.form_field(form.email)}} | ||
{{wtf.form_field(form.password)}} | ||
|
||
<input type="submit" name="submit"> | ||
|
||
|
||
</form> | ||
|
||
|
||
|
||
|
||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{% extends "base.html" %} | ||
{% import "bootstrap/wtf.html" as wtf %} | ||
{{ wtf.quick_form(form) }} | ||
|
||
|
||
|
||
{% block head %} | ||
|
||
<link href="{{ url_for('static', filename='css/off.css')}}" rel="stylesheet"> | ||
{% endblock %} | ||
|
||
|
||
|
||
{% block body %} | ||
<h1> Hallo von Office</h1> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{% extends "base.html" %} | ||
{% import "bootstrap/wtf.html" as wtf %} | ||
{{ wtf.quick_form(form) }} | ||
|
||
{% block head %} | ||
|
||
<link href="{{ url_for('static', filename='css/regeseter.css')}}" rel="stylesheet"> | ||
{% endblock %} | ||
|
||
|
||
|
||
{% block body %} | ||
{% block content %} | ||
<div class="form-wrapper"> | ||
|
||
<div class="logo"> | ||
<img | ||
src="{{ url_for('static', filename='dist/img/logo.png') }}" | ||
alt="logo" | ||
/> | ||
</div> | ||
|
||
{% for message in get_flashed_messages() %} | ||
<div class="alert alert-warning"> | ||
<button | ||
type="button" | ||
class="close" | ||
data-dismiss="alert"> | ||
x | ||
</button> | ||
{{ message }} | ||
</div> | ||
{% endfor %} | ||
|
||
<h1>Sign Up</h1> | ||
|
||
{% endblock %} | ||
<form action="/regester" method="post"> | ||
|
||
|
||
|
||
|
||
{{ form.hidden_tag() }} | ||
{{wtf.form_field(form.vorname)}} | ||
{{wtf.form_field(form.nachname)}} | ||
{{wtf.form_field(form.email)}} | ||
{{wtf.form_field(form.password)}} | ||
<input type="submit" name="submit"> | ||
|
||
|
||
|
||
|
||
</form> | ||
|
||
|
||
|
||
|
||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import yaml | ||
with open('cfg.yaml') as ari: | ||
data = yaml.load(ari, Loader=yaml.FullLoader) | ||
sequenz = data['DATABASE_URI'] | ||
|