Burathar
4 years ago
commit
131497690d
10 changed files with 243 additions and 0 deletions
@ -0,0 +1,140 @@
@@ -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/ |
@ -0,0 +1,13 @@
@@ -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 |
@ -0,0 +1,9 @@
@@ -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) |
@ -0,0 +1,37 @@
@@ -0,0 +1,37 @@
|
||||
{% extends 'bootstrap/base.html' %} |
||||
|
||||
{% block title %} |
||||
{% if title %}{{ title }} - Microblog{% else %}Welcome to Microblog{% endif %} |
||||
{% endblock %} |
||||
|
||||
{% block navbar %} |
||||
<nav class="navbar navbar-default"> |
||||
<div class="container"> |
||||
<div class="navbar-header"> |
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> |
||||
<span class="sr-only">Toggle navigation</span> |
||||
<span class="icon-bar"></span> |
||||
<span class="icon-bar"></span> |
||||
<span class="icon-bar"></span> |
||||
</button> |
||||
<a class="navbar-brand" href="{{ url_for('index') }}">Microblog</a> |
||||
</div> |
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> |
||||
<ul class="nav navbar-nav"> |
||||
<li><a href="{{ url_for('index') }}">Home</a></li> |
||||
</ul> |
||||
<ul class="nav navbar-nav navbar-right"> |
||||
<li><p>Logout</p></li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</nav> |
||||
{% endblock %} |
||||
|
||||
{% block content %} |
||||
<div class="container"> |
||||
{% block app_content %}{% endblock %} |
||||
</div> |
||||
{% endblock %} |
||||
|
||||
|
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
{% extends 'base.html' %} |
||||
|
||||
{% block app_content %} |
||||
|
||||
<h1>Welcome!</h1> |
||||
<h2>{{ message }}</h2> |
||||
|
||||
{% endblock %} |
@ -0,0 +1,9 @@
@@ -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 |
@ -0,0 +1,18 @@
@@ -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 |
Loading…
Reference in new issue