stopspazzing / sanic-mdl-blog Goto Github PK
View Code? Open in Web Editor NEWAn async Python server running Material Design Lite Blog template
An async Python server running Material Design Lite Blog template
As of Sanic-WTF 0.4.0, I removed form.hidden_tag
, the csrf token is still accessible as form.csrf_token
or whatever name you set in configuration.
The reason of removing this is here pyx/sanic-wtf#9 , to put it simply, I figured that to have hidden_tag
in the style of Flask-WTF (e.g, the same API, acts as a callable, including all hidden tags, etc.), we need another dependency (markupsafe
) or roll our own wrapper. I think it may not be worth it, so I decided to remove the misbehave form.hidden_tag
.
Please correct me if I am wrong. Thanks.
Traceback (most recent call last):
File "run.py", line 3, in
from app import app
File "/root/test/Sanic-MDL-Blog/app/init.py", line 5, in
from app import views
File "/root/test/Sanic-MDL-Blog/app/views.py", line 110
o.write(f'DB_URI = {repr(uri)}\n')
^
SyntaxError: invalid syntax
When I open the browser to http://127.0.0.1:8000 I see this error:
Error
('HY000', '[HY000] [SQLite]no such table: blog_data (1) (1) (SQLExecDirectW)')
I guess db must be prepared and populated first? Would you mind providing some noob-friendly detailed steps for that part, too? ;-)
Here is the full output in the terminal:
2017-05-13 14:57:56,651: INFO: Goin' Fast @ http://127.0.0.1:8000
Server successfully started!
2017-05-13 14:57:56,693: INFO: Starting worker [24940]
2017-05-13 14:58:10,324: ERROR: Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/sanic/app.py", line 465, in handle_request
response = await response
File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 128, in throw
return self.gen.throw(type, value, traceback)
File "main.py", line 207, in index
await cur.execute('SELECT * FROM blog_data;')
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
pyodbc.Error: ('HY000', '[HY000] [SQLite]no such table: blog_data (1) (1) (SQLExecDirectW)')
2017-05-13 14:58:10,327: ERROR: Exception occurred while handling uri: "http://127.0.0.1:8000/"
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/sanic/app.py", line 465, in handle_request
response = await response
File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 128, in throw
return self.gen.throw(type, value, traceback)
File "main.py", line 207, in index
await cur.execute('SELECT * FROM blog_data;')
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
pyodbc.Error: ('HY000', '[HY000] [SQLite]no such table: blog_data (1) (1) (SQLExecDirectW)')
2017-05-13 14:58:10,487: ERROR: Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/sanic/app.py", line 465, in handle_request
response = await response
File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 128, in throw
return self.gen.throw(type, value, traceback)
File "main.py", line 222, in post
await cur.execute('SELECT * FROM blog_data WHERE post_name="{name}";')
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
pyodbc.Error: ('HY000', '[HY000] [SQLite]no such table: blog_data (1) (1) (SQLExecDirectW)')
2017-05-13 14:58:10,490: ERROR: Exception occurred while handling uri: "http://127.0.0.1:8000/favicon.ico"
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/sanic/app.py", line 465, in handle_request
response = await response
File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 128, in throw
return self.gen.throw(type, value, traceback)
File "main.py", line 222, in post
await cur.execute('SELECT * FROM blog_data WHERE post_name="{name}";')
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
pyodbc.Error: ('HY000', '[HY000] [SQLite]no such table: blog_data (1) (1) (SQLExecDirectW)')
2017-05-13 14:59:10,006: ERROR: NoneType: None
2017-05-13 14:59:10,008: ERROR: NoneType: None
Line 70 in 2d267d5
Line 70 and 71 in models.py the ; is missing at the end of queries. If Config set to demo content = false, the app will crash as no tables created.
Nice project. Hope you will finish it one day. Would like to see sqlalchemy, alembic migrations and mysql implemented. Might do it myself... Thanks
Installation with Python 3.4 fails with:
RuntimeError: aioodbc doesn't support Python earlier than 3.5
Installation with Python 3.5 / 3.6 fails with:
Failed building wheel for ujson ... fatal error: Python.h: No such file or directory
Failed building wheel for httptools ... fatal error: Python.h: No such file or directory
Failed building wheel for pyodbc ... fatal error: Python.h: No such file or directory
After installation on Windows7 with Sanic 0.4.1 and running python main.py
I get this error:
Error - Config Not Found
...
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.