mirror of
https://github.com/skylanix/MamieHenriette.git
synced 2026-02-06 06:40:35 +01:00
extraction du modul database et creation de page vide
This commit is contained in:
12
database/__init__.py
Normal file
12
database/__init__.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from sqlalchemy.sql import text
|
||||
from webapp import webapp
|
||||
|
||||
webapp.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db'
|
||||
db = SQLAlchemy(webapp)
|
||||
|
||||
with webapp.app_context():
|
||||
with open('database/schema.sql', 'r') as f:
|
||||
sql_script = f.read()
|
||||
db.session.execute(text(sql_script))
|
||||
db.session.commit()
|
||||
@@ -1,4 +1,5 @@
|
||||
from webapp import db
|
||||
# from webapp import db
|
||||
from database import db
|
||||
|
||||
class Message(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
@@ -1,15 +1,5 @@
|
||||
from flask import Flask
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from sqlalchemy.sql import text
|
||||
|
||||
webapp = Flask(__name__)
|
||||
webapp.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db'
|
||||
db = SQLAlchemy(webapp)
|
||||
|
||||
from webapp import routes
|
||||
|
||||
with webapp.app_context():
|
||||
with open('schema.sql', 'r') as f:
|
||||
sql_script = f.read()
|
||||
db.session.execute(text(sql_script))
|
||||
db.session.commit()
|
||||
from webapp import commandes, index, messages, moderation
|
||||
|
||||
6
webapp/commandes.py
Normal file
6
webapp/commandes.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from flask import render_template
|
||||
from webapp import webapp
|
||||
|
||||
@webapp.route("/commandes")
|
||||
def commandes():
|
||||
return render_template("commandes.html")
|
||||
@@ -1,6 +1,7 @@
|
||||
from flask import Flask, render_template
|
||||
from webapp import webapp, db
|
||||
from webapp.models import Message
|
||||
from flask import render_template
|
||||
from webapp import webapp
|
||||
# from database import db
|
||||
# from database.message import Message
|
||||
|
||||
@webapp.route("/")
|
||||
def index():
|
||||
11
webapp/messages.py
Normal file
11
webapp/messages.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from flask import render_template
|
||||
from webapp import webapp
|
||||
# from database import db
|
||||
# from database.message import Message
|
||||
|
||||
@webapp.route("/messages")
|
||||
def messages():
|
||||
# message = Message(text="bla bla", periodicity = 3600)
|
||||
# db.session.add(message)
|
||||
# db.session.commit()
|
||||
return render_template("messages.html")
|
||||
6
webapp/moderation.py
Normal file
6
webapp/moderation.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from flask import render_template
|
||||
from webapp import webapp
|
||||
|
||||
@webapp.route("/moderation")
|
||||
def moderation():
|
||||
return render_template("moderation.html")
|
||||
6
webapp/templates/commandes.html
Normal file
6
webapp/templates/commandes.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{% extends "template.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Configuration des Commandes.</h1>
|
||||
<p>TODO</p>
|
||||
{% endblock %}
|
||||
@@ -1,5 +1,7 @@
|
||||
{% extends "template.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Bienvenue sur l'interface d'administrationde Mamie.</h1>
|
||||
<h1>Bienvenue sur l'interface d'administration de Mamie.</h1>
|
||||
<p>Nous devons définir ce que nous souhaitons afficher sur la page d'acceuil. Peut-être l'historique des derniere
|
||||
modification ? de la modération ?</p>
|
||||
{% endblock %}
|
||||
6
webapp/templates/messages.html
Normal file
6
webapp/templates/messages.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{% extends "template.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Configuration des Messages.</h1>
|
||||
<p>TODO</p>
|
||||
{% endblock %}
|
||||
6
webapp/templates/moderation.html
Normal file
6
webapp/templates/moderation.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{% extends "template.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Modération.</h1>
|
||||
<p>TODO</p>
|
||||
{% endblock %}
|
||||
@@ -18,10 +18,9 @@
|
||||
<nav>
|
||||
<a href="/"><img src="/static/ico/favicon.ico"></a>
|
||||
<ul>
|
||||
<li><a href="/">Modération</a></li>
|
||||
<li><a href="/">Messages</a></li>
|
||||
<li><a href="/">Commandes</a></li>
|
||||
<li><a href="/">Configuration</a></li>
|
||||
<li><a href="/commandes">Commandes</a></li>
|
||||
<li><a href="/messages">Messages</a></li>
|
||||
<li><a href="/moderation">Modération</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
Reference in New Issue
Block a user