Skip to content

Commit 3f36e61

Browse files
committed
Initial commit
0 parents  commit 3f36e61

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1014
-0
lines changed

flaskblog/__init__.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from flask import Flask
2+
from flask_sqlalchemy import SQLAlchemy
3+
from flask_bcrypt import Bcrypt
4+
from flask_login import LoginManager
5+
from flask_mail import Mail
6+
from flaskblog.config import Config
7+
8+
9+
db = SQLAlchemy()
10+
bcrypt = Bcrypt()
11+
login_manager = LoginManager()
12+
login_manager.login_view = 'users.login'
13+
login_manager.login_message_category = 'info'
14+
15+
mail = Mail()
16+
17+
def create_app(config_class=Config):
18+
app = Flask(__name__)
19+
app.config.from_object(Config)
20+
21+
db.init_app(app)
22+
bcrypt.init_app(app)
23+
login_manager.init_app(app)
24+
mail.init_app(app)
25+
26+
from flaskblog.users.routes import users
27+
from flaskblog.posts.routes import posts
28+
from flaskblog.main.routes import main
29+
from flaskblog.errors.handlers import errors
30+
31+
app.register_blueprint(users)
32+
app.register_blueprint(posts)
33+
app.register_blueprint(main)
34+
app.register_blueprint(errors)
35+
36+
return app
1.59 KB
Binary file not shown.
729 Bytes
Binary file not shown.
5.32 KB
Binary file not shown.
3.78 KB
Binary file not shown.
13.5 KB
Binary file not shown.

flaskblog/config.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import os
2+
3+
4+
class Config:
5+
SECRET_KEY = os.environ.get('SECRET_KEY')
6+
SQLALCHEMY_DATABASE_URI = 'sqlite:///site.db'
7+
MAIL_SERVER = 'smtp.googlemail.com'
8+
MAIL_PORT = 587
9+
MAIL_USE_TLS = True
10+
MAIL_USERNAME = os.environ.get('EMAIL_USER')
11+
MAIL_PASSWORD = 'nmon ndgb alia uacu'

flaskblog/errors/__init__.py

Whitespace-only changes.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)