forked from sixu05202004/flaskblog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xayyuu
committed
Jan 8, 2018
1 parent
c4903b1
commit 2c505b3
Showing
11 changed files
with
71 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
基于https://github.com/sixu05202004/flaskblog 的源代码进行二次开发,暂时先用这个结构,会逐渐过渡,替换掉其中许多内容。 | ||
基于https://github.com/sixu05202004/flaskblog 的源代码(在此感谢原作者,如有版权问题,请通知我,我会立即删除相关内容)进行二次开发,暂时先用这个结构,未来将逐渐过渡,优化整体内容。 | ||
|
||
如果有任何问题,欢迎联系: [email protected] | ||
如有任何问题,欢迎联系: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#coding=utf-8 | ||
|
||
|
||
# for auth | ||
from flask import Blueprint | ||
|
||
auth = Blueprint('auth', __name__) | ||
|
||
from . import views |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# -*- coding: utf-8 -*- | ||
from flask import Flask, render_template, url_for, redirect, request, flash, session, g, abort | ||
from myapp import app | ||
from model import article_tags, Category, Post, Tag, Comment, pageby, db | ||
from werkzeug import secure_filename | ||
from werkzeug.contrib.atom import AtomFeed | ||
from flask_cache import Cache | ||
from random import shuffle | ||
from HTMLParser import HTMLParser | ||
from re import sub | ||
from sys import stderr | ||
from traceback import print_exc | ||
import os | ||
import json | ||
import time | ||
from datetime import datetime | ||
from form import CommentForm | ||
from config import CATALOG | ||
|
||
from . import auth | ||
|
||
|
||
@auth.route('/login', methods=['GET', 'POST']) | ||
def login(): | ||
error = None | ||
if request.method == 'POST': | ||
if request.form['username'] != app.config['USERNAME']: | ||
error = 'Invalid username' | ||
flash(error) | ||
elif request.form['password'] != app.config['PASSWORD']: | ||
error = 'Invalid password' | ||
flash(error) | ||
else: | ||
session['logged_in'] = True | ||
flash('You were logged in') | ||
return redirect(url_for('newpost')) | ||
return render_template('auth/login.html') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
|
||
markdown = functools.partial(markdown.markdown, | ||
safe_mode='remove', | ||
output_format="html") | ||
output_format="html") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
# -*- coding: utf-8 -*- | ||
from flask import Flask | ||
|
||
|
||
app = Flask(__name__) | ||
app.config.from_object('config') | ||
from views import * | ||
|
||
from auth import auth as auth_blueprint | ||
app.register_blueprint(auth_blueprint) | ||
|
||
from auth.views import * | ||
from views import * | ||
|
||
if __name__ == '__main__': | ||
app.run(host='0.0.0.0', port=5000, debug=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,3 @@ Flask-Testing == 0.4.1 | |
Flask-Script == 0.6.7 | ||
Flask-Uploads == 0.1.3 | ||
markdown >= 2.5.2 | ||
gevent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters