Skip to content
Snippets Groups Projects
Commit 1d306d64 authored by Alessandro Frigeri's avatar Alessandro Frigeri
Browse files

sviluppo flask

parent 1d89bab2
No related branches found
No related tags found
No related merge requests found
from flask import Flask
from config import Config
app = Flask(__name__)
app.config.from_object(Config)
from app import routes
from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy
app = Flask( __name__ )
app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite://rock_catalog_IAPS.db"
app.config['SECRET_KEY'] = 'you-will-never-guess'
class Specimen(db.Model):
id = db.column(db.Integer, primary_key=True)
content = db.Column(db.String(200), nullable=False)
archive = db.Column(db.String(200), nullable=False)
@app.route('/')
def index():
return render_template("index.html")
if __name__ == "__main__":
app.run(debug=True)
import os
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess'
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import DataRequired
class LoginForm(FlaskForm):
username = StringField('Username', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired()])
remember_me = BooleanField('Remember Me')
submit = SubmitField('Sign In')
body {
margin: 0;
font-family: sans-serif;
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="{{ url_for('static',filename='css/main.css') }}">
{% block head %}{% endblock %}
</head>
<body>
{% block body %}
{% endblock %}
</body>
</html>
{% extends 'base.html' %}
{% block head %}
{% endblock %}
{% block body %}
<h1>Template</h1>
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment