From d1c9cfc371f6e4cb415642225c895728ee6e8c34 Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Tue, 5 Apr 2022 17:34:05 -0400 Subject: [PATCH] Add Application base Add python ignore types Add Readme changes for development --- .gitignore | 14 ++++++++++++++ README.md | 6 ++++++ period/__init__.py | 25 +++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 period/__init__.py diff --git a/.gitignore b/.gitignore index 4c49bd7..7c4ef84 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,15 @@ .env +venv/ + +*.pyc +__pycache__/ + +instance/ + +.pytest_cache/ +.coverage +htmlcov/ + +dist/ +build/ +*.egg-info/ \ No newline at end of file diff --git a/README.md b/README.md index 244b409..99735fb 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,8 @@ # period +## Development + +``` +export FLASK_APP=period; export FLASK_ENV=development; flask run + +``` \ No newline at end of file diff --git a/period/__init__.py b/period/__init__.py new file mode 100644 index 0000000..644b3dc --- /dev/null +++ b/period/__init__.py @@ -0,0 +1,25 @@ +import os +from flask import Flask + +def create_app(test_config=None): + app = Flask(__name__, instance_relative_config=True) + app.config.from_mapping( + SECRET_KEY='dev', + DATABASE=os.path.join(app.instance_path, 'period.sqlite') + ) + + if test_config is None: + app.config.from_pyfile('config.py', silent=True) + else: + app.config.from_mapping(test_config) + + try: + os.makedirs(app.instance_path) + except OSError: + pass + + @app.route('/hello') + def hello(): + return 'Hello, World!' + + return app \ No newline at end of file