alexanderjulo / wiki Goto Github PK
View Code? Open in Web Editor NEWa flask based wiki, using markdown files as backend. completely file based!
License: BSD 3-Clause "New" or "Revised" License
a flask based wiki, using markdown files as backend. completely file based!
License: BSD 3-Clause "New" or "Revised" License
Create, Edit, Move, Delete
I wasn't sure if the omitting of javascript was intentional. And if so, then disregard this.
But if not, I'd like to refactor some things utilizing bootstrap better. This includes flashes > alerts. And some basic UI retooling.
Let me know if you would be open to this.
Currently Search is case-sensitive. This could be advantage or disadvantage, depending on circumstances. I'd prefer case insensitive search or at least an option to choose one or the other.
Cheers
How can I use images in my wiki? The Markdown syntax does not seem to work.
I installed wiki as WSGI application behind Apache.
Having non-ascii file names in CONTENT_DIR produces and error due /index
call.
Standalone wiki web
works ok there.
Error creating (err_create.log) non-ascii page and get Index (err_index.log)
err_create.log
err_index.log
As of Flask-Login 0.3 is_active
, is_authenticated
and is_anonymous
are properties and should not be called.
This leads to 500 errors if PRIVATE is set to True in config.py
Replace
if current_app.config.get('PRIVATE') and not current_user.is_authenticated():
with
if current_app.config.get('PRIVATE') and not current_user.is_authenticated:
in
https://github.com/alexanderjulo/wiki/blob/master/wiki/web/user.py
I cannot find where it used.
Application works ok without pygments installed.
app.py fails PEP8.
Example from 3788258:
alexex-wiki$ pep8 app.py | cut -f2- -d' ' | sort | uniq -c
23 E302 expected 2 blank lines, found 1
4 E303 too many blank lines (3)
1 E501 line too long (81 characters)
1 E501 line too long (82 characters)
301 W191 indentation contains tabs
1 W291 trailing whitespace
1 W293 blank line contains whitespace
This isn't going to get any easier...
as you know, I've forked the project and I'm happily working on this. At this time, my code diverged enough and I'm taking some design decisions on my own (because I'm already using it and need some features asap), so I've stopped sending pull requests
But then... which license should I use? As it is based on the great work you did, need to know what is yours. Of couse, mine will be OSS, hopefully BSD (like Flask, django)
URL are generated correctly only if content is in at most one directory: x/file.md -> x/file
When file structure goes a little bit deeper, url takes only first directory in the path: x/y/file.md -> x/file
I was messing around with the tests some, it seems to be an upstream issue with pytest_runner that causes tests on python 3.3 to fail. The error:
travis@93b9068ce8dd:~/wiki-master$ python setup.py test
['tests', 'wiki', 'wiki.web']
running pytest
Traceback (most recent call last):
File "setup.py", line 29, in <module>
'wiki=wiki.cli:main'
File "/home/travis/opt/python/3.3.6/lib/python3.3/distutils/core.py", line 147, in setup
dist.run_commands()
File "/home/travis/opt/python/3.3.6/lib/python3.3/distutils/dist.py", line 930, in run_commands
self.run_command(cmd)
File "/home/travis/opt/python/3.3.6/lib/python3.3/distutils/dist.py", line 949, in run_command
cmd_obj.run()
File "/home/travis/wiki-master/.eggs/pytest_runner-4.0-py3.3.egg/ptr.py", line 157, in run
File "/home/travis/wiki-master/.eggs/pytest_runner-4.0-py3.3.egg/ptr.py", line 118, in install_dists
AttributeError: type object 'test' has no attribute 'install_dists'
I created a new branch which removed 3.3 testing, is there any reason we should keep testing 3.3? If so maybe an upstream ticket should be opened to resolve this? Interestingly python 3.3 testing behaves differently if ran directly or using a virtualenv (all tests pass using a virtualenv) I'll clean up the dockerfile I was using for testing, create a gist and post the link here so others can easily have a look.
Second issue is that tests are still failing on python 3.4 on windows. I haven't had time to dig into that as much as I don't have windows test machines setup, maybe I'll setup some virtual machines later. But in the appveyor logs it looks like there's a problem with jinja2 and then it also seems to fail with
File "c:\projects\wiki\.eggs\pytest_runner-4.0-py3.4.egg\ptr.py", line 157, in run
File "c:\projects\wiki\.eggs\pytest_runner-4.0-py3.4.egg\ptr.py", line 118, in install_dists
AttributeError: type object 'test' has no attribute 'install_dists'
which is the same error python 3.3 was throwing on linux.
This wiki app uses localhost by default (127.0.0.1:5000). Is it possible to specify which host and port to use? I know that in Flask you do this with the --host
and --port
flags.
My current site already has a collection of apps using python3.4 flask and such.
How does it look to port this to python3?
Pyflake report an undefined variable here
$ pyflakes app.py
app.py:156: undefined name 'page'
Just a thought, there are 2 simple ways to go about this:
Python Markdown's included WikiLinks support.
It works, but not very good.
Semantic WikiLinks extension allows for better features but adds a dependency.
Works as well, but there are problems when you try to mess with the output.
Each are simple to implement, but neither operate perfectly. 1) is easier to get going and output capable. 2) Allows for a prettier link and semantic data, but I've found it fails heavily when you begin to alter the output (ie everything gets escaped: <a href...
= %lt;a href...
)
So this all depends upon how you want it implemented. You could also roll your own. Based on d7c3740 you'll want to mess with the content so that the same cleaning functions are passed to the wikilink, so things are not as trivial as simply activating the extension. But shouldn't be too difficult to correct.
Just figured I'd throw out the options and see if anything sticks.
We need to be able to search for:
As is traditional, search should be implemented as GET, not POST.
In order for the URL to be changed, the entire content of a page must be copied and pasted onto a new page. Create, edit and delete the page are available but not the option to edit the URL. Thank you.
Move action allows page (.md file) to be placed outside configured content directory. Renaming page as ../something is allowed (if file permissions does not restricts this).
Internal Server Error
Traceback:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/gunicorn/workers/sync.py", line 131, in handle_request
return self['title']
File "/root/a/wiki/app.py", line 151, in __getitem__
item = self._meta[name]
KeyError: 'title'
I think if there is no title
or tags
in file, we can get title
from filename, tags
also can get from filename, for example :
learning vim(learn,vim).md
we can get :
title='learning vim'
tags='learn,vim'
Some pages must require to log in to access despite global PRIVATE=False.
Maybe using markdown meta or special filenames (like .*.md).
Super feature will be to hide their wikilinks.
Adding a wikilink to a page (e.g., [[Test]]
) results in a werkzeug.routing.BuildError in wiki.core.wikilink
because url_for
is called with "display"
instead of "wiki.display"
.
Not sure how this ever worked?
Here's the full error:
[2020-07-20 14:54:25,262] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/home/satwell/git/wiki/venv/lib/python3.8/site-packages/flask/app.py", line 2284, in wsgi_app
response = self.full_dispatch_request()
File "/home/satwell/git/wiki/venv/lib/python3.8/site-packages/flask/app.py", line 1807, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/satwell/git/wiki/venv/lib/python3.8/site-packages/flask/app.py", line 1710, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/satwell/git/wiki/venv/lib/python3.8/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/home/satwell/git/wiki/venv/lib/python3.8/site-packages/flask/app.py", line 1805, in full_dispatch_request
rv = self.dispatch_request()
File "/home/satwell/git/wiki/venv/lib/python3.8/site-packages/flask/app.py", line 1791, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/satwell/git/wiki/wiki/web/user.py", line 147, in wrapper
return f(*args, **kwargs)
File "/home/satwell/git/wiki/wiki/web/routes.py", line 32, in home
page = current_wiki.get('home')
File "/home/satwell/git/wiki/wiki/core.py", line 265, in get
return Page(path, url)
File "/home/satwell/git/wiki/wiki/core.py", line 181, in __init__
self.render()
File "/home/satwell/git/wiki/wiki/core.py", line 193, in render
self._html, self.body, self._meta = processor.process()
File "/home/satwell/git/wiki/wiki/core.py", line 169, in process
self.process_post()
File "/home/satwell/git/wiki/wiki/core.py", line 156, in process_post
current = processor(current)
File "/home/satwell/git/wiki/wiki/core.py", line 70, in wikilink
url_formatter('display', url=url),
File "/home/satwell/git/wiki/venv/lib/python3.8/site-packages/flask/helpers.py", line 341, in url_for
return appctx.app.handle_url_build_error(error, endpoint, values)
File "/home/satwell/git/wiki/venv/lib/python3.8/site-packages/flask/app.py", line 2053, in handle_url_build_error
reraise(exc_type, exc_value, tb)
File "/home/satwell/git/wiki/venv/lib/python3.8/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/home/satwell/git/wiki/venv/lib/python3.8/site-packages/flask/helpers.py", line 329, in url_for
rv = url_adapter.build(endpoint, values, method=method,
File "/home/satwell/git/wiki/venv/lib/python3.8/site-packages/werkzeug/routing.py", line 2179, in build
raise BuildError(endpoint, values, method, self)
werkzeug.routing.BuildError: Could not build url for endpoint 'display' with values ['url']. Did you mean 'wiki.display' instead?
This project should ship with some demo content. I suggest three trivial pages (including the home page), a config.py that just contains comments, and a users.json that has one or two dummy users.
It occurs to me that we could leverage the demo content as the documentation for the system. README.md gets a user up-and-running, and any advanced documentation is shipped in the content directory.
Thoughts?
As the wiki uses Bootstrap 2.1.1, the responsiveness media queries are outdated and do not take retina screens into account. Because of that, the wiki is displayed on the iPhone 8 plus (1242 x 2208 px = 414 x 736 points) as it's displayed on the desktop app.
I believe the possible fixes are updating the media queries on responsive.css or updating bootstrap to the current 4.1.1 version.
We can auto-generate a random secret key on startup. As it is the only setting that is required that would make the config file unnecessary and would greatly simplify getting started.
For example:
packages=find_packages(exclude=['tests']),
Can I get a relatively detailed installation tutorial, such as CENTOS7? The program is good, but IT would be meaningless to use only advanced developers or IT practitioners.
Idea:
For current version: https://github.com/alexanderjulo/wiki/tree/v2.0.1
When content/config.py has PRIVATE=True
settings:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/home/johniez/sources/alex-wiki/wiki/web/user.py", line 146, in wrapper
return loginmanager.unauthorized()
NameError: global name 'loginmanager' is not defined
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wiki/web/user.py", line 147, in wrapper
return f(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wiki/web/routes.py", line 71, in edit
page.save()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wiki/core.py", line 199, in save
self.render()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wiki/core.py", line 184, in render
processor = Processor(self.content)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wiki/core.py", line 92, in __init__
'tables'
TypeError: __init__() takes 1 positional argument but 2 were given
127.0.0.1 - - [11/Jan/2019 17:59:09] "POST /edit/dd/ HTTP/1.1" 500 -
config.py
:
# encoding: utf-8
SECRET_KEY='a unique and long key'
TITLE='Wiki' # Title Optional
Now if you put *.md into content folder, that have no title: ...
string you will get HTTP 500.
Maybe better way to not skip them but try to get 1st H1
line
UserManager update() method reads and writes users.json file, but if two processes (for example two people will login at ~ same time) performs update() simultaneously, the later one can overwrite the data with some old version. Same applies for delete_user() method, but it is probably unused now.
And a note for auth: writing 'authenticated' flag into users.json is not necessary, as the user successfully loaded using loginmanager.user_loader has to be authenticated (or he was, just before he was written to the session after successfull login).
This is pretty much the exact type of wiki I have been looking for. Admittedly, I had been searching for PHP/js packages because I am more familiar with those languages and forgive me if the following issue is due to my lack of experience with python.
I installed the wiki via pip - per the README.md, on a vps and most of everything works out of the box with a reverse proxy (using caddy).
When I "create a page," however, it redirects to localhost:5000/edit/XYZ.
On Nodejs, a problem like that is often solved by providing the site's url in settings and perhaps it would be the same here in the config.py but passing a "URL" field did not seem do the trick.
Any suggestion for this redirect would be greatly appreciated.
PS: is there a way to see all the variables that config.py accepts?
Right now, this project is branded as "wiki", which is like naming your pet dog "Dog"...
The name "microWiki" is already taken.
The name "fliki", which combines Flask and wiki, is also taken.
Our best bet may be something abstract or whimsical, since that can minimize name collisions. Still there might be a descriptive or evocative name that no one else has thought of.
Ideas?
Adds a md file, but I can't access it via the page.
PS D:\Leonard\OneDrive\Dokument\random flask wiki thing\content> wiki web
Traceback (most recent call last):
File "C:\Python27\Scripts\wiki-script.py", line 11, in <module>
load_entry_point('wiki2==2.0.3', 'console_scripts', 'wiki')()
File "c:\python27\lib\site-packages\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "c:\python27\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "c:\python27\lib\site-packages\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\python27\lib\site-packages\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\python27\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "c:\python27\lib\site-packages\click\decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\python27\lib\site-packages\wiki\cli.py", line 38, in web
app = create_app(ctx.meta['directory'])
File "c:\python27\lib\site-packages\wiki\web\__init__.py", line 38, in create_app
os.path.join(app.config.get('CONTENT_DIR'), 'config.py')
File "c:\python27\lib\site-packages\flask\config.py", line 132, in from_pyfile
exec(compile(config_file.read(), filename, "exec"), d.__dict__)
File "D:\Leonard\OneDrive\Dokument\random flask wiki thing\content\config.py", line 2, in <module>
SECRET_KEY=JvoGTgriz6yn8WsJhOdf9gHv4A5f8braI2jA9IPNSE2ZT8MMqgVpSqFxf6lzR4hicD0rlxMAGHI61PAyrs5gr0h0sYFqqlum8EAP
NameError: name 'JvoGTgriz6yn8WsJhOdf9gHv4A5f8braI2jA9IPNSE2ZT8MMqgVpSqFxf6lzR4hicD0rlxMAGHI61PAyrs5gr0h0sYFqqlum8EAP' is not defined
PS D:\Leonard\OneDrive\Dokument\random flask wiki thing\content> wiki web
* Serving Flask app "wiki.web" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [30/Nov/2020 13:14:16] "←[37mGET / HTTP/1.1←[0m" 200 -
127.0.0.1 - - [30/Nov/2020 13:14:18] "←[37mGET /static/pygments.css HTTP/1.1←[0m" 200 -
127.0.0.1 - - [30/Nov/2020 13:14:18] "←[37mGET /static/responsive.css HTTP/1.1←[0m" 200 -
127.0.0.1 - - [30/Nov/2020 13:14:18] "←[37mGET /static/bootstrap.css HTTP/1.1←[0m" 200 -
127.0.0.1 - - [30/Nov/2020 13:14:18] "←[37mGET /static/bootstrap.min.js HTTP/1.1←[0m" 200 -
127.0.0.1 - - [30/Nov/2020 13:14:19] "←[32mGET /favicon.ico HTTP/1.1←[0m" 308 -
127.0.0.1 - - [30/Nov/2020 13:14:19] "←[33mGET /favicon.ico/ HTTP/1.1←[0m" 404 -
c:\python27\lib\site-packages\wiki\web\routes.py:66: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = EditorForm(obj=page)
127.0.0.1 - - [30/Nov/2020 13:14:25] "←[37mGET /edit/home/ HTTP/1.1←[0m" 200 -
c:\python27\lib\site-packages\wiki\web\routes.py:66: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = EditorForm(obj=page)
[2020-11-30 13:14:54,778] ERROR in app: Exception on /edit/home/ [POST]
Traceback (most recent call last):
File "c:\python27\lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\python27\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\python27\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "c:\python27\lib\site-packages\wiki\web\user.py", line 147, in wrapper
return f(*args, **kwargs)
File "c:\python27\lib\site-packages\wiki\web\routes.py", line 71, in edit
page.save()
File "c:\python27\lib\site-packages\wiki\core.py", line 199, in save
self.render()
File "c:\python27\lib\site-packages\wiki\core.py", line 184, in render
processor = Processor(self.content)
File "c:\python27\lib\site-packages\wiki\core.py", line 92, in __init__
'tables'
TypeError: __init__() takes exactly 1 argument (2 given)
127.0.0.1 - - [30/Nov/2020 13:14:54] "←[35m←[1mPOST /edit/home/ HTTP/1.1←[0m" 500 -
[2020-11-30 13:15:23,920] ERROR in app: Exception on /edit/home/ [POST]
Traceback (most recent call last):
File "c:\python27\lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\python27\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\python27\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "c:\python27\lib\site-packages\wiki\web\user.py", line 147, in wrapper
return f(*args, **kwargs)
File "c:\python27\lib\site-packages\wiki\web\routes.py", line 65, in edit
page = current_wiki.get(url)
File "c:\python27\lib\site-packages\wiki\core.py", line 255, in get
return Page(path, url)
File "c:\python27\lib\site-packages\wiki\core.py", line 174, in __init__
self.render()
File "c:\python27\lib\site-packages\wiki\core.py", line 184, in render
processor = Processor(self.content)
File "c:\python27\lib\site-packages\wiki\core.py", line 92, in __init__
'tables'
TypeError: __init__() takes exactly 1 argument (2 given)
127.0.0.1 - - [30/Nov/2020 13:15:23] "←[35m←[1mPOST /edit/home/ HTTP/1.1←[0m" 500 -
[2020-11-30 13:15:27,490] ERROR in app: Exception on /edit/home/ [GET]
Traceback (most recent call last):
File "c:\python27\lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\python27\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\python27\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "c:\python27\lib\site-packages\wiki\web\user.py", line 147, in wrapper
return f(*args, **kwargs)
File "c:\python27\lib\site-packages\wiki\web\routes.py", line 65, in edit
page = current_wiki.get(url)
File "c:\python27\lib\site-packages\wiki\core.py", line 255, in get
return Page(path, url)
File "c:\python27\lib\site-packages\wiki\core.py", line 174, in __init__
self.render()
File "c:\python27\lib\site-packages\wiki\core.py", line 184, in render
processor = Processor(self.content)
File "c:\python27\lib\site-packages\wiki\core.py", line 92, in __init__
'tables'
TypeError: __init__() takes exactly 1 argument (2 given)
127.0.0.1 - - [30/Nov/2020 13:15:27] "←[35m←[1mGET /edit/home/ HTTP/1.1←[0m" 500 -
c:\python27\lib\site-packages\wiki\web\routes.py:134: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = LoginForm()
127.0.0.1 - - [30/Nov/2020 13:15:33] "←[37mGET /user/login/ HTTP/1.1←[0m" 200 -
c:\python27\lib\site-packages\wiki\web\routes.py:55: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = URLForm()
127.0.0.1 - - [30/Nov/2020 13:15:35] "←[37mGET /create/ HTTP/1.1←[0m" 200 -
c:\python27\lib\site-packages\wiki\web\routes.py:55: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = URLForm()
127.0.0.1 - - [30/Nov/2020 13:15:41] "←[32mPOST /create/ HTTP/1.1←[0m" 302 -
c:\python27\lib\site-packages\wiki\web\routes.py:66: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = EditorForm(obj=page)
127.0.0.1 - - [30/Nov/2020 13:15:41] "←[37mGET /edit/e/ HTTP/1.1←[0m" 200 -
c:\python27\lib\site-packages\wiki\web\routes.py:66: FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
form = EditorForm(obj=page)
[2020-11-30 13:15:44,602] ERROR in app: Exception on /edit/e/ [POST]
Traceback (most recent call last):
File "c:\python27\lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\python27\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\python27\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "c:\python27\lib\site-packages\wiki\web\user.py", line 147, in wrapper
return f(*args, **kwargs)
File "c:\python27\lib\site-packages\wiki\web\routes.py", line 71, in edit
page.save()
File "c:\python27\lib\site-packages\wiki\core.py", line 199, in save
self.render()
File "c:\python27\lib\site-packages\wiki\core.py", line 184, in render
processor = Processor(self.content)
File "c:\python27\lib\site-packages\wiki\core.py", line 92, in __init__
'tables'
TypeError: __init__() takes exactly 1 argument (2 given)
127.0.0.1 - - [30/Nov/2020 13:15:44] "←[35m←[1mPOST /edit/e/ HTTP/1.1←[0m" 500 -
PS D:\Leonard\OneDrive\Dokument\random flask wiki thing\content> wiki web
* Serving Flask app "wiki.web" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
[2020-11-30 13:16:47,305] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "c:\python27\lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\python27\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\python27\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "c:\python27\lib\site-packages\wiki\web\user.py", line 147, in wrapper
return f(*args, **kwargs)
File "c:\python27\lib\site-packages\wiki\web\routes.py", line 32, in home
page = current_wiki.get('home')
File "c:\python27\lib\site-packages\wiki\core.py", line 255, in get
return Page(path, url)
File "c:\python27\lib\site-packages\wiki\core.py", line 174, in __init__
self.render()
File "c:\python27\lib\site-packages\wiki\core.py", line 184, in render
processor = Processor(self.content)
File "c:\python27\lib\site-packages\wiki\core.py", line 92, in __init__
'tables'
TypeError: __init__() takes exactly 1 argument (2 given)
127.0.0.1 - - [30/Nov/2020 13:16:47] "←[35m←[1mGET / HTTP/1.1←[0m" 500 -
[2020-11-30 13:16:58,552] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "c:\python27\lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\python27\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\python27\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "c:\python27\lib\site-packages\wiki\web\user.py", line 147, in wrapper
return f(*args, **kwargs)
File "c:\python27\lib\site-packages\wiki\web\routes.py", line 32, in home
page = current_wiki.get('home')
File "c:\python27\lib\site-packages\wiki\core.py", line 255, in get
return Page(path, url)
File "c:\python27\lib\site-packages\wiki\core.py", line 174, in __init__
self.render()
File "c:\python27\lib\site-packages\wiki\core.py", line 184, in render
processor = Processor(self.content)
File "c:\python27\lib\site-packages\wiki\core.py", line 92, in __init__
'tables'
TypeError: __init__() takes exactly 1 argument (2 given)
127.0.0.1 - - [30/Nov/2020 13:16:58] "←[35m←[1mGET / HTTP/1.1←[0m" 500 -
[2020-11-30 13:17:20,540] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "c:\python27\lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\python27\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\python27\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "c:\python27\lib\site-packages\wiki\web\user.py", line 147, in wrapper
return f(*args, **kwargs)
File "c:\python27\lib\site-packages\wiki\web\routes.py", line 32, in home
page = current_wiki.get('home')
File "c:\python27\lib\site-packages\wiki\core.py", line 255, in get
return Page(path, url)
File "c:\python27\lib\site-packages\wiki\core.py", line 174, in __init__
self.render()
File "c:\python27\lib\site-packages\wiki\core.py", line 184, in render
processor = Processor(self.content)
File "c:\python27\lib\site-packages\wiki\core.py", line 92, in __init__
'tables'
TypeError: __init__() takes exactly 1 argument (2 given)
127.0.0.1 - - [30/Nov/2020 13:17:20] "←[35m←[1mGET / HTTP/1.1←[0m" 500 -
127.0.0.1 - - [30/Nov/2020 13:17:31] "←[32mGET /wiki HTTP/1.1←[0m" 308 -
127.0.0.1 - - [30/Nov/2020 13:17:32] "←[33mGET /wiki/ HTTP/1.1←[0m" 404 -
[2020-11-30 13:17:36,720] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "c:\python27\lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\python27\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\python27\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "c:\python27\lib\site-packages\wiki\web\user.py", line 147, in wrapper
return f(*args, **kwargs)
File "c:\python27\lib\site-packages\wiki\web\routes.py", line 32, in home
page = current_wiki.get('home')
File "c:\python27\lib\site-packages\wiki\core.py", line 255, in get
return Page(path, url)
File "c:\python27\lib\site-packages\wiki\core.py", line 174, in __init__
self.render()
File "c:\python27\lib\site-packages\wiki\core.py", line 184, in render
processor = Processor(self.content)
File "c:\python27\lib\site-packages\wiki\core.py", line 92, in __init__
'tables'
TypeError: __init__() takes exactly 1 argument (2 given)
127.0.0.1 - - [30/Nov/2020 13:17:36] "←[35m←[1mGET / HTTP/1.1←[0m" 500 -
127.0.0.1 - - [30/Nov/2020 13:17:38] "←[33mGET /wiki/ HTTP/1.1←[0m" 404 -
[2020-11-30 13:17:40,086] ERROR in app: Exception on /index/ [GET]
Traceback (most recent call last):
File "c:\python27\lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\python27\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\python27\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "c:\python27\lib\site-packages\wiki\web\user.py", line 147, in wrapper
return f(*args, **kwargs)
File "c:\python27\lib\site-packages\wiki\web\routes.py", line 41, in index
pages = current_wiki.index()
File "c:\python27\lib\site-packages\wiki\core.py", line 316, in index
page = Page(path, url)
File "c:\python27\lib\site-packages\wiki\core.py", line 174, in __init__
self.render()
File "c:\python27\lib\site-packages\wiki\core.py", line 184, in render
processor = Processor(self.content)
File "c:\python27\lib\site-packages\wiki\core.py", line 92, in __init__
'tables'
TypeError: __init__() takes exactly 1 argument (2 given)
127.0.0.1 - - [30/Nov/2020 13:17:40] "←[35m←[1mGET /index/ HTTP/1.1←[0m" 500 -
127.0.0.1 - - [30/Nov/2020 13:17:41] "←[33mGET /wiki/ HTTP/1.1←[0m" 404 -
127.0.0.1 - - [30/Nov/2020 13:17:44] "←[32mGET /wiki/e HTTP/1.1←[0m" 308 -
127.0.0.1 - - [30/Nov/2020 13:17:44] "←[33mGET /wiki/e/ HTTP/1.1←[0m" 404 -
[2020-11-30 13:17:54,742] ERROR in app: Exception on /e/ [GET]
Traceback (most recent call last):
File "c:\python27\lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\python27\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\python27\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "c:\python27\lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "c:\python27\lib\site-packages\wiki\web\user.py", line 147, in wrapper
return f(*args, **kwargs)
File "c:\python27\lib\site-packages\wiki\web\routes.py", line 48, in display
page = current_wiki.get_or_404(url)
File "c:\python27\lib\site-packages\wiki\core.py", line 259, in get_or_404
page = self.get(url)
File "c:\python27\lib\site-packages\wiki\core.py", line 255, in get
return Page(path, url)
File "c:\python27\lib\site-packages\wiki\core.py", line 174, in __init__
self.render()
File "c:\python27\lib\site-packages\wiki\core.py", line 184, in render
processor = Processor(self.content)
File "c:\python27\lib\site-packages\wiki\core.py", line 92, in __init__
'tables'
TypeError: __init__() takes exactly 1 argument (2 given)
127.0.0.1 - - [30/Nov/2020 13:17:54] "←[35m←[1mGET /e/ HTTP/1.1←[0m" 500 -
127.0.0.1 - - [30/Nov/2020 13:17:56] "←[33mGET /wiki/e/ HTTP/1.1←[0m" 404 -
Transparent auth[orization/entication] as WSGI application of Apache:
Idea:
USE_GIT = True
.USE_GIT
is True
then:
Thoughts?
There is no documentation about to run wiki right from sources.
Without pip install
, python setup.py
etc.
cli.wsgi() - callback for WSGI
Enable (default) or disable self-registration.
Disabling is usual for personal or limited wiki.
This currently unreachable code will raise "NameError: name 'page' is not defined
" if it is ever reached. The problem lies inside the inner function (closure) _walk:
def _walk(directory, path_prefix=()):
for name in os.listdir(directory):
fullname = os.path.join(directory, name)
if os.path.isdir(fullname):
_walk(fullname, path_prefix + (name,))
elif name.endswith('.md'):
if not path_prefix:
url = name[:-3]
else:
url = os.path.join(path_prefix[0], name[:-3])
if attr:
pages[getattr(page, attr)] = page # <-- bug here
else:
pages.append(Page(fullname, url.replace('\\', '/')))
Additionally:
_walk
inner function should be replaced by the use of the os.walk
iterator.Wiki.index
can be either a list or a dict, depending on whether the attr parameter has a true value.Wiki.get_by_title
, which in turn is never called. * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
[2017-01-21 23:01:25,688] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.5/dist-packages/flask/_compat.py", line 33, in reraise
raise value
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.5/dist-packages/wiki/web/user.py", line 147, in wrapper
return f(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/wiki/web/routes.py", line 35, in home
return render_template('home.html')
File "/usr/local/lib/python3.5/dist-packages/flask/templating.py", line 133, in render_template
return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
File "/usr/local/lib/python3.5/dist-packages/jinja2/environment.py", line 869, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
File "/usr/local/lib/python3.5/dist-packages/jinja2/environment.py", line 830, in get_template
return self._load_template(name, self.make_globals(globals))
File "/usr/local/lib/python3.5/dist-packages/jinja2/environment.py", line 804, in _load_template
template = self.loader.load(self, name, globals)
File "/usr/local/lib/python3.5/dist-packages/jinja2/loaders.py", line 113, in load
source, filename, uptodate = self.get_source(environment, name)
File "/usr/local/lib/python3.5/dist-packages/flask/templating.py", line 57, in get_source
return self._get_source_fast(environment, template)
File "/usr/local/lib/python3.5/dist-packages/flask/templating.py", line 85, in _get_source_fast
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: home.html
127.0.0.1 - - [21/Jan/2017 23:01:25] "GET / HTTP/1.1" 500 -
[2017-01-21 23:01:26,060] ERROR in app: Exception on /favicon.ico/ [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.5/dist-packages/wiki/web/user.py", line 147, in wrapper
return f(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/wiki/web/routes.py", line 48, in display
page = current_wiki.get_or_404(url)
File "/usr/local/lib/python3.5/dist-packages/wiki/core.py", line 205, in get_or_404
abort(404)
File "/usr/local/lib/python3.5/dist-packages/werkzeug/exceptions.py", line 646, in __call__
raise self.mapping[code](*args, **kwargs)
werkzeug.exceptions.NotFound: 404: Not Found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1512, in handle_user_exception
return self.handle_http_exception(e)
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1471, in handle_http_exception
return handler(e)
File "/usr/local/lib/python3.5/dist-packages/wiki/web/routes.py", line 182, in page_not_found
return render_template('404.html'), 404
File "/usr/local/lib/python3.5/dist-packages/flask/templating.py", line 133, in render_template
return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
File "/usr/local/lib/python3.5/dist-packages/jinja2/environment.py", line 869, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
File "/usr/local/lib/python3.5/dist-packages/jinja2/environment.py", line 830, in get_template
return self._load_template(name, self.make_globals(globals))
File "/usr/local/lib/python3.5/dist-packages/jinja2/environment.py", line 804, in _load_template
template = self.loader.load(self, name, globals)
File "/usr/local/lib/python3.5/dist-packages/jinja2/loaders.py", line 113, in load
source, filename, uptodate = self.get_source(environment, name)
File "/usr/local/lib/python3.5/dist-packages/flask/templating.py", line 57, in get_source
return self._get_source_fast(environment, template)
File "/usr/local/lib/python3.5/dist-packages/flask/templating.py", line 85, in _get_source_fast
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: 404.html
127.0.0.1 - - [21/Jan/2017 23:01:26] "GET /favicon.ico/ HTTP/1.1" 500 -
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.