DataNews
所属分类:后台框架
开发工具:JavaScript
文件大小:606KB
下载次数:0
上传日期:2013-09-25 19:42:22
上 传 者:
sh-1993
说明: DataNews是发布和讨论数据相关新闻的地方。用烧瓶Python建造。
(DataNews is a place to post and discuss data-related news. Built with Flask Python.)
文件列表:
CHANGES (98, 2013-09-26)
LICENSE (1450, 2013-09-26)
Procfile (243, 2013-09-26)
alembic.ini (879, 2013-09-26)
alembic (0, 2013-09-26)
alembic\env.py (2256, 2013-09-26)
alembic\script.py.mako (412, 2013-09-26)
data_news (0, 2013-09-26)
data_news\__init__.py (5458, 2013-09-26)
data_news\admin (0, 2013-09-26)
data_news\admin\__init__.py (24, 2013-09-26)
data_news\admin\views.py (1230, 2013-09-26)
data_news\api (0, 2013-09-26)
data_news\api\__init__.py (22, 2013-09-26)
data_news\api\views.py (855, 2013-09-26)
data_news\background (0, 2013-09-26)
data_news\background\__init__.py (60, 2013-09-26)
data_news\background\models.py (302, 2013-09-26)
data_news\background\twitter.py (6895, 2013-09-26)
data_news\config.py (2513, 2013-09-26)
data_news\frontend (0, 2013-09-26)
data_news\frontend\__init__.py (99, 2013-09-26)
data_news\frontend\forms.py (871, 2013-09-26)
data_news\frontend\models.py (6674, 2013-09-26)
data_news\frontend\views.py (12347, 2013-09-26)
data_news\static (0, 2013-09-26)
data_news\static\.webassets-manifest (47, 2013-09-26)
data_news\static\css (0, 2013-09-26)
data_news\static\css\bootstrap.css (95373, 2013-09-26)
data_news\static\css\font-awesome.css (3719, 2013-09-26)
data_news\static\css\main.8f0fd81e.css (81925, 2013-09-26)
data_news\static\css\site.css (2944, 2013-09-26)
data_news\static\font (0, 2013-09-26)
data_news\static\font\FontAwesome.3.2.1.otf (61896, 2013-09-26)
data_news\static\font\fontawesome-webfont.3.2.1.eot (37405, 2013-09-26)
data_news\static\font\fontawesome-webfont.3.2.1.svg (197829, 2013-09-26)
data_news\static\font\fontawesome-webfont.3.2.1.ttf (79076, 2013-09-26)
... ...
# DataNews
[DataNews.co](http://datanews.co) is a web application for posting and discussing data-oriented news.
Built with:
* Python/Flask
* SQLalchemy
* Backbone.js
* Require.js
* Twitter Bootstrap
## Features
* Post and discuss URLs or Text
* Vote up any post or comment
* Nested discussions
* Permalinks for every post or comment
* User pages
* Admin section
* API
* Submit via Twitter
### Items (Post, Comment, Page, External)
The central part of DataNews is an ***item***. There are several kinds of items: `post`, `comment`, `page`, `external`. Each item can be accessed at a specific url: `/item/17`, where 17 is the item id number.
Other notes:
* Every item has an owner, the user who created it.
* On the page for each item you can add comments, edit (if you are the owner), or upvote the item.
#### Posts, Comments
Posts and comments generally function the same. There is slightly different formatting and stying for Posts.
Every post has a Title and either a URL or Text. Comment consists of just text.
#### Page, External
Pages and External links are used to add links to the footer (held in Flask's global object). A page is an internal DataNews page (e.g. About). An external link is used to link outside the site.
Only super admins can add pages.
### Users
Login is required for anything except viewing pages. A logged in user can submit posts, comments, and up vote items. Every user has a unique URL to view their information. They can also use this page to change their username, email, or twitter handle.
We use Flask-Security to handle most of user creation and authetication (with some modification).
#### Roles
There are three types of user roles:
| Role | Description | Access |
| ---------- | -------------| ----- |
| user | The basic role given to all users. | Can submit posts and comment. |
| admin | Basic admin role for editing comments or posts. | Can access basic admin panel for `Items` and `Votes`. |
| super | Full-privilege admin to access the whole world. | Can access `User`, `Role`, and `Twitter` panels in admin area |
### Votes
Currently votes are only positive. A vote includes the user who votes, the item voted for, the user who created the item, and the timestamp.
### Submit Via Twitter
Users can submit via Twitter by adding their twitter handle to their user page (currently no verification). Then they tweet @DataNews.
There is a schedule process which checks for new mentions. If we have new mentions and we find a user with a handle then we begin the submission process. See background > twitter.py for full documentation.
## Development
DataNews uses Flask and several Flask extensions.
### Local Development
* Clone the repository
* Create and activate a virtual environment
* Install packages with `pip install -r requirements.txt`
* Create database with `python manage.py db_create`. This will create a local sqlite database.
* Run local webserver with `python manage.py runserver`
### Script Commands
There are several commands available in manage.py. Each can be run with `python manage.py command`.
| Command | Description | Options |
| ------------- | -------------| ----- |
| `runserver` | Runs Flask's development server at [localhost:5000](http://localhost:5000).| |
| `db_create` | Drops all old tables and creates a new database. Will also create a super-admin user with un: *admin* and pw: *password*. This account is associated with the first admin listed in the config file. ||
| `db_migrate` | Creates a db migration script using Alembic | `-m` allows you to add a migration message.|
| `db_upgrade` | Upgrades db using most recent migration script.||
| `build_js` |Builds the JS using r.js. Outputs a minified JS file to app.min.VERSION_NUMBER.js|`-g` allows you to gzip JS files (app.min.js and require.js).|
| `clear_cache` |Clears the application cache.||
| `twitter` |Fetches posts submitted via twitter. Can be run as a background process. ||
## License
BSD license, Copyright (c) 2013 by Joe Hand. See license file for details.
近期下载者:
相关文件:
收藏者: