Compare commits
10 Commits
dependabot
...
heroku
Author | SHA1 | Date | |
---|---|---|---|
15c1d25351 | |||
2fcf9d7a33 | |||
fddb20c713 | |||
a50c9be35f | |||
3ad11eaa4e | |||
4745131d75 | |||
c0a9dfffad | |||
43a8d4020e | |||
329abd48aa | |||
663a94a305 |
@ -1 +0,0 @@
|
|||||||
The main objective of this repository is to provide an example of CRUD with Flask, maximum simplicity. If you want to add new features, please create a Fork of it and notify me of its existence so I can add it in the README as support material.
|
|
@ -1,5 +1,7 @@
|
|||||||
# Flask contacts
|
# Flask contacts
|
||||||
|
|
||||||
|
[DEMO](http://flask-contacts.programadorwebvalencia.com)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Use
|
## Use
|
||||||
@ -28,7 +30,3 @@ python3 app.py
|
|||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
## Forks with extensions
|
|
||||||
|
|
||||||
- 
|
|
||||||
|
6
app.py
6
app.py
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
from flask import Flask, redirect, url_for, render_template, request, flash
|
from flask import Flask, redirect, url_for, render_template, request, flash
|
||||||
from models import db, Contact
|
from models import db, Contact
|
||||||
from forms import ContactForm
|
from forms import ContactForm
|
||||||
@ -8,8 +9,7 @@ app.config['SECRET_KEY'] = 'my secret'
|
|||||||
app.config['DEBUG'] = False
|
app.config['DEBUG'] = False
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///book.sqlite'
|
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL')
|
||||||
# app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://root@localhost/book'
|
|
||||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||||
db.init_app(app)
|
db.init_app(app)
|
||||||
|
|
||||||
@ -74,7 +74,9 @@ def contacts():
|
|||||||
'''
|
'''
|
||||||
Show alls contacts
|
Show alls contacts
|
||||||
'''
|
'''
|
||||||
|
print(app.config['SQLALCHEMY_DATABASE_URI'])
|
||||||
contacts = Contact.query.order_by(Contact.name).all()
|
contacts = Contact.query.order_by(Contact.name).all()
|
||||||
|
print(len(contacts))
|
||||||
return render_template('web/contacts.html', contacts=contacts)
|
return render_template('web/contacts.html', contacts=contacts)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
import os
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///book.sqlite'
|
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL')
|
||||||
#app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://root@localhost/book'
|
|
||||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||||
db = SQLAlchemy(app)
|
db = SQLAlchemy(app)
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
Faker==0.7.11
|
Faker==0.7.11
|
||||||
Flask==2.3.2
|
Flask==0.12.1
|
||||||
Flask-SQLAlchemy==2.5.1
|
Flask-SQLAlchemy==2.2
|
||||||
Flask-WTF==0.14.3
|
Flask-WTF==0.14.2
|
||||||
gunicorn
|
gunicorn
|
||||||
Werkzeug==2.0.3
|
psycopg2-binary
|
||||||
Jinja2==3.0.0
|
|
||||||
email_validator
|
|
||||||
|
Reference in New Issue
Block a user