commit 131497690d39ad63bce8a2b43447b4e4be11579f Author: Burathar Date: Tue Jun 30 11:52:26 2020 +0200 Add empty flask site diff --git a/.flaskenv b/.flaskenv new file mode 100644 index 0000000..9af662f --- /dev/null +++ b/.flaskenv @@ -0,0 +1 @@ +FLASK_APP=the_hunt.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..24a1300 --- /dev/null +++ b/.gitignore @@ -0,0 +1,140 @@ +# Source: https://github.com/github/gitignore/blob/master/Python.gitignore + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..0aaa8f5 --- /dev/null +++ b/app/__init__.py @@ -0,0 +1,13 @@ +from flask import Flask +from flask_bootstrap import Bootstrap +from config import Config +from flask_sqlalchemy import SQLAlchemy +from flask_migrate import Migrate + +app = Flask(__name__) +app.config.from_object(Config) +bootstrap = Bootstrap(app) +db = SQLAlchemy(app) +migrate = Migrate(app, db) + +from app import routes, models diff --git a/app/models.py b/app/models.py new file mode 100644 index 0000000..1d404a5 --- /dev/null +++ b/app/models.py @@ -0,0 +1,2 @@ +from app import db + diff --git a/app/routes.py b/app/routes.py new file mode 100644 index 0000000..27ffdf9 --- /dev/null +++ b/app/routes.py @@ -0,0 +1,9 @@ +from flask import render_template, flash, redirect, url_for, request +from app import app, db +#from app.forms import - + +@app.route('/', methods=['GET']) +@app.route('/index', methods=['GET']) +def index(): + message="Hello, World" + return render_template("index.html", title='Home', message=message) diff --git a/app/templates/base.html b/app/templates/base.html new file mode 100644 index 0000000..2ddea63 --- /dev/null +++ b/app/templates/base.html @@ -0,0 +1,37 @@ +{% extends 'bootstrap/base.html' %} + +{% block title %} +{% if title %}{{ title }} - Microblog{% else %}Welcome to Microblog{% endif %} +{% endblock %} + +{% block navbar %} + +{% endblock %} + +{% block content %} +
+ {% block app_content %}{% endblock %} +
+{% endblock %} + + diff --git a/app/templates/index.html b/app/templates/index.html new file mode 100644 index 0000000..01be431 --- /dev/null +++ b/app/templates/index.html @@ -0,0 +1,8 @@ +{% extends 'base.html' %} + +{% block app_content %} + +

Welcome!

+

{{ message }}

+ +{% endblock %} diff --git a/config.py b/config.py new file mode 100644 index 0000000..b6ed349 --- /dev/null +++ b/config.py @@ -0,0 +1,9 @@ +import os +from pathlib import Path +basedir = Path(__file__).parent.absolute() + +class Config(object): + SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess' + SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \ + f"sqlite:///{Path(basedir) / 'app.db'}" + SQLALCHEMY_TRACK_MODIFICATIONS = False diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..1003e69 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,18 @@ +alembic==1.4.2 +click==7.1.2 +dominate==2.5.1 +Flask==1.1.2 +Flask-Bootstrap==3.3.7.1 +Flask-Migrate==2.5.3 +Flask-SQLAlchemy==2.4.3 +itsdangerous==1.1.0 +Jinja2==2.11.2 +Mako==1.1.3 +MarkupSafe==1.1.1 +python-dateutil==2.8.1 +python-dotenv==0.13.0 +python-editor==1.0.4 +six==1.15.0 +SQLAlchemy==1.3.18 +visitor==0.1.3 +Werkzeug==1.0.1 diff --git a/the_hunt.py b/the_hunt.py new file mode 100644 index 0000000..27894c1 --- /dev/null +++ b/the_hunt.py @@ -0,0 +1,6 @@ +from app import app, db +#from app.models import User, Post + +@app.shell_context_processor +def make_shell_context(): + return {'db': db}