selfboot / nahan Goto Github PK
View Code? Open in Web Editor NEWA simple BBS forum based on flask, mainly for learning Web Design.
A simple BBS forum based on flask, mainly for learning Web Design.
On Ubuntu:
$ pip install Pillow
may fails with this error:
ValueError: --enable-jpeg requested but jpeg not found, aborting.
When install MySQL-python, may fails too:
rmicro@ubuntu:~$ pip install MySQL-python
Downloading/unpacking MySQL-python
Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded
Running setup.py egg_info for package MySQL-python
sh: mysql_config: not found
Traceback (most recent call last):
File "", line 14, in
File "/home/rmicro/build/MySQL-python/setup.py", line 15, in
metadata, options = get_config()
File "setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "setup_posix.py", line 24, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
Complete output from command python setup.py egg_info:
sh: mysql_config: not foundCommand python setup.py egg_info failed with error code 1
数据库需要怎么初始化啊。。。
sqlalchemy.exc.OperationalError
OperationalError: (_mysql_exceptions.OperationalError) (1049, "Unknown database 'nahan'")
Traceback (most recent call last)
File "C:\NaHan\lib\site-packages\flask\app.py", line 2000, in call
return self.wsgi_app(environ, start_response)
File "C:\NaHan\lib\site-packages\flask\app.py", line 1991, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "C:\NaHan\lib\site-packages\flask\app.py", line 1567, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\NaHan\lib\site-packages\flask\app.py", line 1988, in wsgi_app
response = self.full_dispatch_request()
File "C:\NaHan\lib\site-packages\flask\app.py", line 1641, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\NaHan\lib\site-packages\flask\app.py", line 1544, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\NaHan\lib\site-packages\flask\app.py", line 1639, in full_dispatch_request
rv = self.dispatch_request()
File "C:\NaHan\lib\site-packages\flask\app.py", line 1625, in dispatch_request
return self.view_functionsrule.endpoint
File "D:\Git\NaHan\nahan\voice\views.py", line 28, in index
topics = topics_all[offset:offset + per_page]
File "C:\NaHan\lib\site-packages\sqlalchemy\orm\query.py", line 2457, in getitem
return list(res)
File "C:\NaHan\lib\site-packages\sqlalchemy\orm\query.py", line 2761, in iter
return self._execute_and_instances(context)
File "C:\NaHan\lib\site-packages\sqlalchemy\orm\query.py", line 2774, in _execute_and_instances
close_with_result=True)
File "C:\NaHan\lib\site-packages\sqlalchemy\orm\query.py", line 2765, in _connection_from_session
**kw)
File "C:\NaHan\lib\site-packages\sqlalchemy\orm\session.py", line 893, in connection
execution_options=execution_options)
File "C:\NaHan\lib\site-packages\sqlalchemy\orm\session.py", line 898, in _connection_for_bind
engine, execution_options)
File "C:\NaHan\lib\site-packages\sqlalchemy\orm\session.py", line 334, in _connection_for_bind
conn = bind.contextual_connect()
File "C:\NaHan\lib\site-packages\sqlalchemy\engine\base.py", line 2039, in contextual_connect
self._wrap_pool_connect(self.pool.connect, None),
File "C:\NaHan\lib\site-packages\sqlalchemy\engine\base.py", line 2078, in _wrap_pool_connect
e, dialect, self)
File "C:\NaHan\lib\site-packages\sqlalchemy\engine\base.py", line 1405, in _handle_dbapi_exception_noconnection
exc_info
File "C:\NaHan\lib\site-packages\sqlalchemy\util\compat.py", line 202, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "C:\NaHan\lib\site-packages\sqlalchemy\engine\base.py", line 2074, in _wrap_pool_connect
return fn()
File "C:\NaHan\lib\site-packages\sqlalchemy\pool.py", line 376, in connect
return _ConnectionFairy._checkout(self)
File "C:\NaHan\lib\site-packages\sqlalchemy\pool.py", line 713, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "C:\NaHan\lib\site-packages\sqlalchemy\pool.py", line 480, in checkout
rec = pool._do_get()
File "C:\NaHan\lib\site-packages\sqlalchemy\pool.py", line 1060, in _do_get
self._dec_overflow()
File "C:\NaHan\lib\site-packages\sqlalchemy\util\langhelpers.py", line 60, in exit
compat.reraise(exc_type, exc_value, exc_tb)
File "C:\NaHan\lib\site-packages\sqlalchemy\pool.py", line 1057, in _do_get
return self._create_connection()
File "C:\NaHan\lib\site-packages\sqlalchemy\pool.py", line 323, in _create_connection
return _ConnectionRecord(self)
File "C:\NaHan\lib\site-packages\sqlalchemy\pool.py", line 449, in init
self.connection = self.__connect()
File "C:\NaHan\lib\site-packages\sqlalchemy\pool.py", line 607, in __connect
connection = self.__pool.invoke_creator(self)
File "C:\NaHan\lib\site-packages\sqlalchemy\engine\strategies.py", line 97, in connect
return dialect.connect(*cargs, **cparams)
File "C:\NaHan\lib\site-packages\sqlalchemy\engine\default.py", line 385, in connect
return self.dbapi.connect(*cargs, **cparams)
File "C:\NaHan\lib\site-packages\MySQLdb_init.py", line 81, in Connect
return Connection(*args, **kwargs)
File "C:\NaHan\lib\site-packages\MySQLdb\connections.py", line 193, in init
super(Connection, self).init(*args, **kwargs2)
OperationalError: (_mysql_exceptions.OperationalError) (1049, "Unknown database 'nahan'")
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:
dump() shows all variables in the frame
dump(obj) dumps all that's known about the object
Sometimes the content in the topic may be long, then when one want to add an append, he has to scroll down the page th find the edit box.
page pagination does not work well.
Need to be fixed
Detail about CSRF can be found here:
https://en.wikipedia.org/wiki/Cross-site_request_forgery
Flask CSRf protection demo can be found here:
http://flask.pocoo.org/snippets/3/
And if use flask-WTF, need to do nothing to avoid CSRF.
Sometimes when we create a topic or have commit a reply, it turns out "-1 years ago" unexpectedly. But when we refresh the page, times seems correct.
When there are many nodes, it may be messy.
Currently when we search for some key words, it searches in title and content respectively.
keys = keywords.split(' ')
all_topics = set(Topic.query.filter(
and_(*[Topic.title.like("%" + k + "%") for k in keys])).all())
content_topics = set(Topic.query.filter(
and_(*[Topic.content.like("%" + k + "%") for k in keys])).all())
When one want to reset password, he will get a reset link. The link contains a unique secret key, which is used to access the password reset page. But when I randomly use a key, I can also reach the reset page.
When we have updated a new avatar, the page remains using the old avatar because of the cache.
ProgrammingError: (_mysql_exceptions.ProgrammingError) (1146, "Table 'nahan.topic' doesn't exist") [SQL: u'SELECT topic.id AS topic_id, topic.title AS topic_title, topic.content AS topic_content, topic.content_rendered AS topic_content_rendered, topic.click AS topic_click, topic.reply_count AS topic_reply_count, topic.topic_deleted AS topic_topic_deleted, topic.node_deleted AS topic_node_deleted, topic.user_deleted AS topic_user_deleted, topic.time_created AS topic_time_created, topic.last_replied AS topic_last_replied, topic.user_id AS topic_user_id, topic.node_id AS topic_node_id, topic.appends AS topic_appends, topic.comments AS topic_comments \nFROM topic \nWHERE (topic.topic_deleted = true OR topic.node_deleted = true OR topic.user_deleted = true) = false ORDER BY topic.time_created DESC \n LIMIT %s'] [parameters: (10,)]
If somebody @me in one topic, and then he edit the topic again(without modify the @me part), I will receive a notify repeatedly.
And what's worse, when some @me firstly, then re-edit the topic and cancel @me. I see one notify which he mention me in the topic, but can't find the @me in the topic after re-edit.
Any way, the notify system need to be improved.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.