Compare commits

..

11 Commits

Author SHA1 Message Date
Andros Fenollosa
7d172c2f07
Update requirements.txt 2022-10-21 12:28:20 +02:00
Andros Fenollosa
d341a81b77
Update README.md 2022-09-07 16:39:52 +02:00
Andros Fenollosa
ec140575ee
Update README.md 2020-08-24 08:44:31 +02:00
Andros Fenollosa
187827d42f
Create CONTRIBUTING.md 2020-08-23 15:57:36 +02:00
Andros Fenollosa
179b2b7724
Merge pull request #9 from philshem/patch-1
add Werkzeug==0.16 and email_validator
2020-07-28 15:48:44 +02:00
@philshem
b5aa021f8a
add Werkzeug==0.16 and email_validator
https://github.com/tanrax/flask-contacts/issues/8
2020-07-28 14:37:58 +02:00
Andros Fenollosa
3822c9b0eb
Merge pull request #7 from tanrax/dependabot/pip/flask-1.0
Bump flask from 0.12.1 to 1.0
2019-11-26 19:31:47 +01:00
dependabot[bot]
a47c21e75e
Bump flask from 0.12.1 to 1.0
Bumps [flask](https://github.com/pallets/flask) from 0.12.1 to 1.0.
- [Release notes](https://github.com/pallets/flask/releases)
- [Changelog](https://github.com/pallets/flask/blob/master/CHANGES.rst)
- [Commits](https://github.com/pallets/flask/compare/0.12.1...1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2019-11-26 07:08:55 +00:00
Andros Fenollosa
69956e4536 Merge branch 'master' of github.com:tanrax/flask-contacts 2018-05-01 14:33:57 +02:00
Andros Fenollosa
87e3b174d9 Add url and opti migrations 2018-05-01 14:33:45 +02:00
Andros Fenollosa
d14ec3bf26
Update README.md 2018-05-01 14:30:19 +02:00
5 changed files with 15 additions and 12 deletions

1
CONTRIBUTING.md Normal file
View File

@ -0,0 +1 @@
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.

View File

@ -1,7 +1,5 @@
# Flask contacts # Flask contacts
[DEMO](http://flask-contacts.programadorwebvalencia.com)
![alls](https://github.com/tanrax/flask-contacts/raw/master/screenshots/alls.jpg) ![alls](https://github.com/tanrax/flask-contacts/raw/master/screenshots/alls.jpg)
## Use ## Use
@ -30,3 +28,7 @@ python3 app.py
![message](https://github.com/tanrax/flask-contacts/raw/master/screenshots/message.jpg) ![message](https://github.com/tanrax/flask-contacts/raw/master/screenshots/message.jpg)
![new](https://github.com/tanrax/flask-contacts/raw/master/screenshots/new.jpg) ![new](https://github.com/tanrax/flask-contacts/raw/master/screenshots/new.jpg)
![search](https://github.com/tanrax/flask-contacts/raw/master/screenshots/search.jpg) ![search](https://github.com/tanrax/flask-contacts/raw/master/screenshots/search.jpg)
## Forks with extensions
- ![Ability to attach a CSV file](https://github.com/areeburrub/flask-contacts)

6
app.py
View File

@ -1,4 +1,3 @@
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
@ -9,7 +8,8 @@ app.config['SECRET_KEY'] = 'my secret'
app.config['DEBUG'] = False app.config['DEBUG'] = False
# Database # Database
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL') app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///book.sqlite'
# 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,9 +74,7 @@ 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)

View File

@ -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'] = os.environ.get('DATABASE_URL') app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///book.sqlite'
#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)

View File

@ -1,6 +1,8 @@
Faker==0.7.11 Faker==0.7.11
Flask==0.12.1 Flask==2.0.3
Flask-SQLAlchemy==2.2 Flask-SQLAlchemy==2.5.1
Flask-WTF==0.14.2 Flask-WTF==0.14.3
gunicorn gunicorn
psycopg2-binary Werkzeug==2.0.3
Jinja2==3.0.0
email_validator