From d529552609489dffc76e7d25fc4ffdf204979c27 Mon Sep 17 00:00:00 2001 From: haskal Date: Thu, 30 May 2019 00:15:17 -0400 Subject: [PATCH] Some initial setup --- .gitignore | 2 ++ README.md | 22 ++++++++++++++++++++++ setup.py | 17 ++++++++++++----- wikilain/__init__.py | 15 +++++++++++++++ wikilain/__main__.py | 4 +++- wikilain/models.py | 13 +++++++++++++ 6 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 README.md create mode 100644 wikilain/models.py diff --git a/.gitignore b/.gitignore index 83456b8..1ddb7da 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ __pycache__ *.egg-info .env .ycm_extra_conf.py +postgres/ +.envrc diff --git a/README.md b/README.md new file mode 100644 index 0000000..6b8085e --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# WikiLain # + +A boneless wiki system. + +## Setup ## +Install requirements: +``` +flask +flask_oidc +sqlalchemy +mistune +mistune_contrib +flask-sqlalchemy +flask-migrate +``` + +``` +export FLASK_APP=wikilain +export FLASK_ENV=development +flask db upgrade +flask run +``` diff --git a/setup.py b/setup.py index 4e21678..9c15bf9 100644 --- a/setup.py +++ b/setup.py @@ -2,13 +2,20 @@ from setuptools import setup setup(name='wikilain', version='0.1', - description='Sample text', - url='https://example.com', - author='John Smith', - author_email='none@example.com', - license='Undecided', + description='Boneless wiki software with a side of Lain', + url='https://git.lain.faith/haskal/wikilain', + author='haskal', + author_email='haskal@bepis.xyz', + license='GPL-3.0-or-later', packages=['wikilain'], install_requires=[ + "flask", + "flask_oidc", + "sqlalchemy", + "mistune", + "mistune_contrib", + "flask-sqlalchemy", + "flask-migrate" ], include_package_data=True, entry_points={ diff --git a/wikilain/__init__.py b/wikilain/__init__.py index e69de29..b276726 100644 --- a/wikilain/__init__.py +++ b/wikilain/__init__.py @@ -0,0 +1,15 @@ +from flask import Flask +from flask_sqlalchemy import SQLAlchemy +from flask_migrate import Migrate + +app = Flask(__name__) +app.config["SQLALCHEMY_DATABASE_URI"] = 'sqlite:////tmp/test.db' +app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False + +from .models import db, migrate, User +db.init_app(app) +migrate.init_app(app, db) + +@app.route("/") +def main_page(): + return "Hello and also world" diff --git a/wikilain/__main__.py b/wikilain/__main__.py index 7df869a..0587d31 100644 --- a/wikilain/__main__.py +++ b/wikilain/__main__.py @@ -1 +1,3 @@ -print("Hello, World!") +from wikilain import app + +app.run() diff --git a/wikilain/models.py b/wikilain/models.py new file mode 100644 index 0000000..f222048 --- /dev/null +++ b/wikilain/models.py @@ -0,0 +1,13 @@ +from flask_sqlalchemy import SQLAlchemy +from flask_migrate import Migrate + +db = SQLAlchemy() +migrate = Migrate(None, db) + +class User(db.Model): + id = db.Column(db.Integer, primary_key=True) + username = db.Column(db.String(80), unique=True, nullable=False) + email = db.Column(db.String(120), unique=True, nullable=False) + + def __repr__(self): + return '' % self.username