Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Book info #55

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

*.pyc
*.log
*.pdf
Expand All @@ -10,4 +11,4 @@
tmp/
.cache
.DS_Store
venv/
venv/
13 changes: 13 additions & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.pyc
*.log
*.pdf

*.py~
*.txt~

.idea/

tmp/
.cache
.DS_Store
venv/
1 change: 1 addition & 0 deletions api/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: python run.py
52 changes: 52 additions & 0 deletions api/api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from flask import Flask, Blueprint, request, abort,url_for, jsonify, g, render_template, make_response,session
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import cast
import os, sqlalchemy, jwt, datetime
from flask_httpauth import HTTPBasicAuth
import uuid
from werkzeug.security import generate_password_hash, check_password_hash
from functools import wraps
from flask_cors import CORS
import openlibrary_api
import requests, json


app = Flask(__name__)

db = SQLAlchemy(app)

CORS(app)
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL')
# app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:postgres@localhost/bookshelf'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['USE_SESSION_FOR_NEXT'] = True
app.config['CORS_HEADERS'] = 'Content-Type'
app.config['SECRET_KEY'] = 'thisissecret'
app.secret_key = os.urandom(24)

#rttr
from app import app
import models

#def createDB():
# engine = sqlalchemy.create_engine('postgresql://postgres:mvjunetwo@localhost') #connects to server
# conn = engine.connect()
# conn.execute("commit")
# conn.execute("create database bookshelf")
# conn.close()


db.create_all()


# =======
# def createDB():
# engine = sqlalchemy.create_engine('postgresql://postgres:postgres@localhost') #connects to server
# conn = engine.connect()
# conn.execute("commit")
# conn.execute("create database bookshelf")
# conn.close()


#createDB()
#createTables()
Loading