This commit is contained in:
commit
95a533c876
451 changed files with 18255 additions and 0 deletions
17
templates/dev/flask-hello/flask_hello/__init__.py
Normal file
17
templates/dev/flask-hello/flask_hello/__init__.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from flask import Flask
|
||||
|
||||
|
||||
def create_app():
|
||||
app = Flask(__name__)
|
||||
|
||||
from .blueprints.home import home_bp
|
||||
|
||||
app.register_blueprint(home_bp)
|
||||
|
||||
from flask import render_template
|
||||
|
||||
@app.errorhandler(404)
|
||||
def not_found_error(error):
|
||||
return render_template("errors.html", error="Page not found"), 404
|
||||
|
||||
return app
|
||||
8
templates/dev/flask-hello/flask_hello/blueprints/home.py
Normal file
8
templates/dev/flask-hello/flask_hello/blueprints/home.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
from flask import Blueprint, render_template
|
||||
|
||||
home_bp = Blueprint("home", __name__)
|
||||
|
||||
|
||||
@home_bp.route("/")
|
||||
def index():
|
||||
return render_template("index.html")
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 40px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #333;
|
||||
}
|
||||
12
templates/dev/flask-hello/flask_hello/templates/base.html
Normal file
12
templates/dev/flask-hello/flask_hello/templates/base.html
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}Flask App{% endblock %}</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
{% block content %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Error</h1>
|
||||
<p>{{ error }}</p>
|
||||
<a href="{{ url_for('home.index') }}">Go Home</a>
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Hello, World!</h1>
|
||||
<p>Welcome to your Flask application.</p>
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue