Skip to content

Commit fd248bf

Browse files
committed
Load env vars from .env.
1 parent 078fa7c commit fd248bf

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,4 @@ venv.bak/
104104

105105
# Etc
106106
.DS_Store
107+
creds

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ url = "https://pypi.org/simple"
44
verify_ssl = true
55

66
[dev-packages]
7-
Python-Dotenv = "*"
87
Lesscpy = "*"
98
CSSMin = "*"
109
JSMin = "*"
@@ -18,6 +17,7 @@ Flask-Session = "*"
1817
PyMySQL = "*"
1918
WTForms = "*"
2019
Redis = "*"
20+
Python-Dotenv = "*"
2121

2222
[requires]
2323
python_version = "3.8"

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Flask-Session Tutorial
22

33
![Python](https://img.shields.io/badge/Python-v^3.8-blue.svg?logo=python&longCache=true&logoColor=white&colorB=5e81ac&style=flat-square&colorA=4c566a)
4-
![Flask](https://img.shields.io/badge/Flask-v1.0.2-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
5-
![Flask-Login](https://img.shields.io/badge/Flask--Login-v0.4.1-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
4+
![Flask](https://img.shields.io/badge/Flask-v1.1.1-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
5+
![Flask-Login](https://img.shields.io/badge/Flask--Login-v0.5.0-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
66
![Flask-Assets](https://img.shields.io/badge/Flask--Assets-v0.12-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
77
![Flask-Session](https://img.shields.io/badge/Flask--Session-v0.3.1-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
88
![Flask-SQLAlchemy](https://img.shields.io/badge/Flask--SQLAlchemy-v2.3.2-red.svg?longCache=true&style=flat-square&logo=flask&logoColor=white&colorA=4c566a&colorB=5e81ac)
99
![WTForms](https://img.shields.io/badge/WTForms-v2.2.1-blue.svg?longCache=true&logo=python&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
10-
![Psycopg2-Binary](https://img.shields.io/badge/Psycopg2--Binary-v2.7.7-red.svg?longCache=true&style=flat-square&logo=scala&logoColor=white&colorA=4c566a&colorB=bf616a)
10+
![PyMySQL](https://img.shields.io/badge/PyMySQL-v0.9.3-red.svg?longCache=true&style=flat-square&logo=scala&logoColor=white&colorA=4c566a&colorB=bf616a)
1111
![Redis](https://img.shields.io/badge/Redis-v3.2.1-red.svg?longCache=true&style=flat-square&logo=redis&logoColor=white&colorA=4c566a&colorB=bf616a)
1212
![GitHub Last Commit](https://img.shields.io/github/last-commit/google/skia.svg?style=flat-square&colorA=4c566a&colorB=a3be8c&logo=GitHub)
1313
[![GitHub Issues](https://img.shields.io/github/issues/hackersandslackers/flask-session-tutorial.svg?style=flat-square&colorA=4c566a&logo=GitHub&colorB=ebcb8b)](https://github.com/hackersandslackers/flask-session-tutorial/issues)

config.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
"""App configuration."""
2-
from os import environ
2+
from os import environ, path
33
import redis
44

5+
from dotenv import load_dotenv
6+
7+
basedir = path.abspath(os.path.dirname(__file__))
8+
load_dotenv(path.join(basedir, '.env'))
9+
510

611
class Config:
712
"""Set Flask configuration vars from .env file."""

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
author_email='toddbirchard@gmail.com',
2121
classifiers=[
2222
'Programming Language :: Python :: 3',
23-
'Programming Language :: Python :: 3.7',
23+
'Programming Language :: Python :: 3.8',
2424
],
2525
keywords='Flask Flask-Session Redis Session Tutorial',
2626
packages=find_packages(),
@@ -30,7 +30,7 @@
3030
'flask_assets',
3131
'flask_session',
3232
'redis',
33-
'psycopg2-binary',
33+
'pymysql',
3434
'wtforms'],
3535
extras_require={
3636
'dev': ['check-manifest'],

0 commit comments

Comments
 (0)