-
Notifications
You must be signed in to change notification settings - Fork 38
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
Showing
4 changed files
with
57 additions
and
14 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 |
---|---|---|
|
@@ -7,6 +7,3 @@ __pycache__/ | |
|
||
# pycharm files | ||
.idea/ | ||
|
||
# some small demos | ||
demo/ |
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,27 +1,73 @@ | ||
# About | ||
# NaHan: A Tiny Forum. | ||
|
||
A Forum(BBS) based on Flask. | ||
NaHan is a tiny forum written by Python flask and bootstrap. Its goal is to learn flask and web development in practice. | ||
|
||
Topic page: | ||
|
||
![][1] | ||
|
||
Admin page: | ||
|
||
![][2] | ||
|
||
# Features | ||
|
||
Major features: | ||
|
||
1. Whole user manage system, contains registration, login, change password, retrieve; | ||
2. Users can create topics, append topics, have comments on topics. | ||
3. Send notifications when others @YOU in anywhere. | ||
4. Markdown supported, whether in topics or comments. | ||
5. A convenient administrator page, one can manage users, topics, nodes. | ||
6. A simple keyword search egine, one can search some specific topics. | ||
1. Whole user manage system, containing registration, login, password change, retrieve; | ||
2. Topic management system, login users can create topics, append topics, have comments on topics. | ||
3. Markdown support in topic, appendix of topic and comment. | ||
4. Can use `@someone` to remind other user anywhere. The user which be is reminded will receive notify. | ||
5. A convenient administrator system, super user can block or activate users, topics, nodes and comments. | ||
6. A simple keyword search engine, one can search some specific topics. | ||
|
||
# How to Run | ||
|
||
1. Firstly, make sure all the relevant requirements installed. | ||
2. Do some configure in config.py. | ||
1. Firstly, make sure all the relevant modules installed. | ||
|
||
You'd better use [virtualenv](https://virtualenv.pypa.io/en/stable/) to create a isolated python environments, and then use pip to install all the requirements. | ||
|
||
pip install -r requirements.txt | ||
|
||
2. Do some custom configure in `config.py`, have a glance as followers: | ||
|
||
# flask config | ||
SECRET_KEY = os.environ.get('SECRET_KEY') or '!@#$%^&*12345678' | ||
# Config about senting email. | ||
MAIL_SERVER = 'smtp.qq.com' | ||
MAIL_PORT = 465 | ||
MAIL_USE_SSL = True | ||
MAIL_USERNAME = os.environ.get('MAIL_USERNAME') | ||
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD') | ||
FORUM_MAIL_SUBJECT_PREFIX = 'NaHan' | ||
FORUM_MAIL_SENDER = 'Nahan <selfboot@qq.com>' | ||
|
||
# Optional, setting about translation. | ||
BABEL_DEFAULT_LOCALE = 'zh' | ||
BABEL_DEFAULT_TIMEZONE = 'CST' | ||
# Some config about forum, containing pagination page size, saving position and limit of avatar. | ||
PER_PAGE = 10 | ||
UPLOAD_FOLDER = os.path.join(basedir, 'nahan/static/upload') | ||
ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg']) | ||
MAX_CONTENT_LENGTH = 512 * 1024 | ||
# Database setting. | ||
SQLALCHEMY_DATABASE_URI = (os.environ.get('DEV_DATABASE_URL') or | ||
'mysql://root:******@localhost/nahan') | ||
|
||
3. Start corresponding database service. | ||
4. Change directory, run `python manage.py runserver`. | ||
|
||
In MacOS, start mysql using the following command: | ||
|
||
mysql.server start | ||
|
||
4. Go to the project's directory, run `python manage.py runserver`. | ||
|
||
For more about how to run a flask project, you need to have much knowledge about flask, [docs](http://flask.pocoo.org/docs/0.11/) can be found here. | ||
|
||
[1]: picture/front_page.png | ||
[2]: picture/admin_page.png | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.