diff --git a/.gitignore b/.gitignore index f8b73e7..f56622f 100644 --- a/.gitignore +++ b/.gitignore @@ -138,3 +138,15 @@ dmypy.json # Cython debug symbols cython_debug/ +*.pyc +__pycache__/ + +instance/ + +.pytest_cache/ +.coverage +htmlcov/ + +dist/ +build/ +*.egg-info/ \ No newline at end of file diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..10f8976 --- /dev/null +++ b/app/__init__.py @@ -0,0 +1,32 @@ +import os + +from flask import Flask + + +def create_app(test_config=None): + # create and configure the app + app = Flask(__name__, instance_relative_config=True) + app.config.from_mapping( + SECRET_KEY='dev', + DATABASE=os.path.join(app.instance_path, 'flaskr.sqlite'), + ) + + if test_config is None: + # load the instance config, if it exists, when not testing + app.config.from_pyfile('config.py', silent=True) + else: + # load the test config if passed in + app.config.from_mapping(test_config) + + # ensure the instance folder exists + try: + os.makedirs(app.instance_path) + except OSError: + pass + + # a simple page that says hello + @app.route('/hello') + def hello(): + return 'Hello, Woooorld!' + + return app \ No newline at end of file diff --git a/flask_app.py b/app/app.py similarity index 95% rename from flask_app.py rename to app/app.py index d29d9f9..5de8b6e 100644 --- a/flask_app.py +++ b/app/app.py @@ -1,5 +1,17 @@ #!/usr/bin/python3 +"""" +from flask import Flask + +app = Flask(__name__) + +@app.route("/") +def hello_world(): + return "
Hello, World!
" +""" + + +""" from flask import Flask, render_template, Blueprint from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker @@ -15,7 +27,6 @@ from create_db import #baze? # Flask app -app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = CONFIG['DB_CONNECTION'] app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True @@ -62,3 +73,5 @@ def index(): if __name__ == "__main__": app.run(debug=True, host = "0.0.0.0") + +""" \ No newline at end of file diff --git a/app/auth.py b/app/auth.py new file mode 100644 index 0000000..e69de29 diff --git a/app/static/style.css b/app/static/style.css new file mode 100644 index 0000000..e69de29 diff --git a/app/templates/auth/login.py b/app/templates/auth/login.py new file mode 100644 index 0000000..e69de29 diff --git a/app/templates/auth/register b/app/templates/auth/register new file mode 100644 index 0000000..e69de29 diff --git a/app/templates/base.py b/app/templates/base.py new file mode 100644 index 0000000..e69de29 diff --git a/create_db.py b/create_db.py index 36f7860..b097848 100644 --- a/create_db.py +++ b/create_db.py @@ -1,5 +1,10 @@ #!/usr/bin/python3 +from csv import unregister_dialect +import email +from sqlite3 import Date +from ssl import _PasswordType +from xmlrpc.client import DateTime from sqlalchemy import Column, Integer, Float, String, Text, TIMESTAMP,ForeignKey from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship @@ -10,12 +15,33 @@ Base = declarative_base() class USER(Base): + __tablename__ = 'user' + id = Column(Integer, primary_key=True, autoincrement=True) + username = Column(String) + password = Column(String) #mogoče raje kaj drugega, neki hash passworda al neki + email = Column(String) class Item(Base): + __tablename__ = 'item' + id = Column(Integer, primary_key=True, autoincrement=True) + owner_id = Column(String, ForeignKey("user.id"), nullable=False) + item_location = Column(String) + item_type = Column(String) + item_size = Column(Integer) class Interest(Base): + __tablename__ = 'interest' + pdf_id = Column(String, ForeignKey("item.id"), nullable=False) + user_id = Column(String, ForeignKey("user.id"), nullable=False) + interest_rate = Column(Float) + #ali +# date_added = Column(String) +# last_review = Column(DateTime) +# interval = Column(Integer) +# due = Column(DateTime) + engine = create_engine(CONFIG['DB_CONNECTION'])