rgalanakis / hostthedocs Goto Github PK
View Code? Open in Web Editor NEWA simple host for static documentation.
License: MIT License
A simple host for static documentation.
License: MIT License
Hi,
We use a fork of hostthedocs in our organization.
Could you please provide some hints on how a cross-project search feature could be implemented?
Or do you have plans of implementing this feature?
Thanks
Discussion area for the comments in #14 (comment).
If a project version has an alpha char in the version somewhere, the sorting fails.
version = 0.0.1
version = 0.0.2a
hostthedocs/static/docfiles/project/0.0.2a
to hostthedocs/static/docfiles/project/0.0.2
(removing the alpha from the folder nameLooks like it's an easy enough fix, but there needs to be discussion:
0.1.a
0.1.b
0.1.c
[Wed Dec 14 13:06:02.437201 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] [2016-12-14 13:06:02,436] ERROR in app: Exception on / [GET]
[Wed Dec 14 13:06:02.437237 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] Traceback (most recent call last):
[Wed Dec 14 13:06:02.437251 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] File "/usr/local/pythonenvs/hostthedocs/lib/python3.5/site-packages/flask/app.py", line 1988, in wsgi_app
[Wed Dec 14 13:06:02.437256 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] response = self.full_dispatch_request()
[Wed Dec 14 13:06:02.437259 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] File "/usr/local/pythonenvs/hostthedocs/lib/python3.5/site-packages/flask/app.py", line 1641, in full_dispatch_request
[Wed Dec 14 13:06:02.437262 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] rv = self.handle_user_exception(e)
[Wed Dec 14 13:06:02.437265 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] File "/usr/local/pythonenvs/hostthedocs/lib/python3.5/site-packages/flask/app.py", line 1544, in handle_user_exception
[Wed Dec 14 13:06:02.437269 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] reraise(exc_type, exc_value, tb)
[Wed Dec 14 13:06:02.437272 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] File "/usr/local/pythonenvs/hostthedocs/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
[Wed Dec 14 13:06:02.437275 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] raise value
[Wed Dec 14 13:06:02.437278 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] File "/usr/local/pythonenvs/hostthedocs/lib/python3.5/site-packages/flask/app.py", line 1639, in full_dispatch_request
[Wed Dec 14 13:06:02.437281 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] rv = self.dispatch_request()
[Wed Dec 14 13:06:02.437284 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] File "/usr/local/pythonenvs/hostthedocs/lib/python3.5/site-packages/flask/app.py", line 1625, in dispatch_request
[Wed Dec 14 13:06:02.437287 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] return self.view_functions[rule.endpoint](**req.view_args)
[Wed Dec 14 13:06:02.437290 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] File "/var/www/hostthedocs/hostthedocs/__init__.py", line 37, in home
[Wed Dec 14 13:06:02.437293 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] projects = parse_docfiles(getconfig.docfiles_dir, getconfig.docfiles_link_root)
[Wed Dec 14 13:06:02.437296 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] File "/var/www/hostthedocs/hostthedocs/filekeeper.py", line 42, in parse_docfiles
[Wed Dec 14 13:06:02.437299 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] for f in sorted(os.listdir(docfiles_dir), key=str.lower)]
[Wed Dec 14 13:06:02.437302 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] File "/var/www/hostthedocs/hostthedocs/filekeeper.py", line 42, in <listcomp>
[Wed Dec 14 13:06:02.437305 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] for f in sorted(os.listdir(docfiles_dir), key=str.lower)]
[Wed Dec 14 13:06:02.437308 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] File "/var/www/hostthedocs/hostthedocs/filekeeper.py", line 28, in _get_proj_dict
[Wed Dec 14 13:06:02.437311 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] versions.sort(key=sort_by_version)
[Wed Dec 14 13:06:02.437316 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332] TypeError: unorderable types: int() < str()
[Wed Dec 14 13:06:02.437339 2016] [wsgi:error] [pid 20112:tid 139763720873728] [remote 192.168.11.124:32332]
[Wed Dec 14 13:06:02.437412 2016] [wsgi:error] [pid 20112:tid 139763720873728] ERROR:hostthedocs:Exception on / [GET]
[Wed Dec 14 13:06:02.437429 2016] [wsgi:error] [pid 20112:tid 139763720873728] Traceback (most recent call last):
[Wed Dec 14 13:06:02.437432 2016] [wsgi:error] [pid 20112:tid 139763720873728] File "/usr/local/pythonenvs/hostthedocs/lib/python3.5/site-packages/flask/app.py", line 1988, in wsgi_app
[Wed Dec 14 13:06:02.437436 2016] [wsgi:error] [pid 20112:tid 139763720873728] response = self.full_dispatch_request()
[Wed Dec 14 13:06:02.437439 2016] [wsgi:error] [pid 20112:tid 139763720873728] File "/usr/local/pythonenvs/hostthedocs/lib/python3.5/site-packages/flask/app.py", line 1641, in full_dispatch_request
[Wed Dec 14 13:06:02.437442 2016] [wsgi:error] [pid 20112:tid 139763720873728] rv = self.handle_user_exception(e)
[Wed Dec 14 13:06:02.437445 2016] [wsgi:error] [pid 20112:tid 139763720873728] File "/usr/local/pythonenvs/hostthedocs/lib/python3.5/site-packages/flask/app.py", line 1544, in handle_user_exception
[Wed Dec 14 13:06:02.437448 2016] [wsgi:error] [pid 20112:tid 139763720873728] reraise(exc_type, exc_value, tb)
[Wed Dec 14 13:06:02.437450 2016] [wsgi:error] [pid 20112:tid 139763720873728] File "/usr/local/pythonenvs/hostthedocs/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
[Wed Dec 14 13:06:02.437453 2016] [wsgi:error] [pid 20112:tid 139763720873728] raise value
[Wed Dec 14 13:06:02.437456 2016] [wsgi:error] [pid 20112:tid 139763720873728] File "/usr/local/pythonenvs/hostthedocs/lib/python3.5/site-packages/flask/app.py", line 1639, in full_dispatch_request
[Wed Dec 14 13:06:02.437459 2016] [wsgi:error] [pid 20112:tid 139763720873728] rv = self.dispatch_request()
[Wed Dec 14 13:06:02.437462 2016] [wsgi:error] [pid 20112:tid 139763720873728] File "/usr/local/pythonenvs/hostthedocs/lib/python3.5/site-packages/flask/app.py", line 1625, in dispatch_request
[Wed Dec 14 13:06:02.437465 2016] [wsgi:error] [pid 20112:tid 139763720873728] return self.view_functions[rule.endpoint](**req.view_args)
[Wed Dec 14 13:06:02.437468 2016] [wsgi:error] [pid 20112:tid 139763720873728] File "/var/www/hostthedocs/hostthedocs/__init__.py", line 37, in home
[Wed Dec 14 13:06:02.437470 2016] [wsgi:error] [pid 20112:tid 139763720873728] projects = parse_docfiles(getconfig.docfiles_dir, getconfig.docfiles_link_root)
[Wed Dec 14 13:06:02.437473 2016] [wsgi:error] [pid 20112:tid 139763720873728] File "/var/www/hostthedocs/hostthedocs/filekeeper.py", line 42, in parse_docfiles
[Wed Dec 14 13:06:02.437476 2016] [wsgi:error] [pid 20112:tid 139763720873728] for f in sorted(os.listdir(docfiles_dir), key=str.lower)]
[Wed Dec 14 13:06:02.437479 2016] [wsgi:error] [pid 20112:tid 139763720873728] File "/var/www/hostthedocs/hostthedocs/filekeeper.py", line 42, in <listcomp>
[Wed Dec 14 13:06:02.437482 2016] [wsgi:error] [pid 20112:tid 139763720873728] for f in sorted(os.listdir(docfiles_dir), key=str.lower)]
[Wed Dec 14 13:06:02.437484 2016] [wsgi:error] [pid 20112:tid 139763720873728] File "/var/www/hostthedocs/hostthedocs/filekeeper.py", line 28, in _get_proj_dict
[Wed Dec 14 13:06:02.437487 2016] [wsgi:error] [pid 20112:tid 139763720873728] versions.sort(key=sort_by_version)
[Wed Dec 14 13:06:02.437491 2016] [wsgi:error] [pid 20112:tid 139763720873728] TypeError: unorderable types: int() < str()
[Wed Dec 14 13:06:02.437498 2016] [wsgi:error] [pid 20112:tid 139763720873728]
When running the server under Python 2.7.12, everything seems to work. When running it under 3.5.2 and trying to push documentation using the exact same commands, the server returns HTTP 500 (internal server error), and it prints this on console:
File "C:\Users\davidfallah\AppData\Local\Programs\Python\Python35-32\lib\site-packages\flask\app.py", line 1988, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\davidfallah\AppData\Local\Programs\Python\Python35-32\lib\site-packages\flask\app.py", line 1641, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\davidfallah\AppData\Local\Programs\Python\Python35-32\lib\site-packages\flask\app.py", line 1544, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\davidfallah\AppData\Local\Programs\Python\Python35-32\lib\site-packages\flask\_compat.py", line 33, in reraise
raise value
File "C:\Users\davidfallah\AppData\Local\Programs\Python\Python35-32\lib\site-packages\flask\app.py", line 1639, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\davidfallah\AppData\Local\Programs\Python\Python35-32\lib\site-packages\flask\app.py", line 1625, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "C:\Users\davidfallah\Documents\hostthedocs\hostthedocs\__init__.py", line 22, in hmfd
request.files.values()[0].stream,
TypeError: 'generator' object is not subscriptable
I changed request.files.values()[0].stream
to list(request.files.values())[0].stream
and this seems to make it work under both Python 2.7.12 and 3.5.2. I have not tested for other versions.
@abrasive changed this in PR #30
https://github.com/rgalanakis/hostthedocs/pull/30/files#diff-452aa13f6fb8e9b475a6a45095e25a1d
Since this, the server returns 302s with the Location header:
http://package/version/index.html
when it was previously (and should be, I'd think) returning:
http://hostname.domain.com/package/version/index.html
Am I missing something with my webserver configuration that you guys are doing to make this work properly with this new change, or is this an actual bug?
Returns a 404
The link to latest version is not working
Below is the debug log
(sample2 is the project name that contains only one version 0.1.2)
127.0.0.1 - - [02/Jul/2019 15:49:54] "GET /sample2/latest HTTP/1.1" 308 -
127.0.0.1 - - [02/Jul/2019 15:51:01] "GET /sample2/latest/ HTTP/1.1" 302 -
127.0.0.1 - - [02/Jul/2019 15:52:19] "GET /sample2/latest/static/docfiles/sample2/0.1.2/index.html HTTP/1.1" 302 -
127.0.0.1 - - [02/Jul/2019 15:52:31] "GET /sample2/latest/static/docfiles/sample2/0.1.2/static/docfiles/sample2/0.1.2/static/docfiles/sample2/0.1.2/index.html HTTP/1.1" 302 -
127.0.0.1 - - [02/Jul/2019 15:52:56] "GET /sample2/latest/static/docfiles/sample2/0.1.2/static/docfiles/sample2/0.1.2/static/docfiles/sample2/0.1.2/static/docfiles/sample2/0.1.2/static/docfiles/sample2/0.1.2/static/docfiles/sample2/0.1.2/static/docfiles/sample2/0.1.2/index.html HTTP/1.1" 302 -
Is login is in the roadmap for this project? Strict requirement for my use case.
There should be a "url_name" parameter or something like that.
When uploading docs where name
has a space in it, you end up getting urls that have %20
:
curl -X POST -F [email protected] -F name="Some Name" -F version="0.0.1" -F description="Some Description" http://my_htd_instance/hmfd
# --> http://my_htd_instance/static/docfiles/Some%20Name/0.0.1/index.html
Personally I find this a bit ugly.
If there were another parameter that we could optionally send, we could do nifty things like this:
curl -X POST -F [email protected] -F url_name="my_project" -F name="Some Name" -F version="0.0.1" -F description="Some Description" http://my_htd_instance/hmfd
# --> http://my_htd_instance/static/docfiles/my_project/0.0.1/index.html
This would allow users to decouple the project name, what's seen here:
from the project url.
If the url_name
parameter is not given, it just defaults to the name
parameter, thus not changing the current functionality
Though personally I'd like to see
name
get URL-ized by going all lowercase and replacing space with underscore or dash, but that's a bit more breaking than what I'm proposing here.
First off, thank you so much for creating this project! Much like you, I was dismayed to find little support for self-hosting docs. I was happy to find your project, as it is really close to what I need.
I've been working on some modifications to this project, which have begun to diverge:
/docs/
/hmfd
Are these updates in line with your vision of the project? If so, I'll submit a PR. If not, I'll create a "fork" of the project and change the name. If I do fork, how would you like your project to be credited?
Great project!
I'm wondering if the root route will list all projects that are on the server?
For example, if my site is hosted at http://hostthedocs.mycompany and I have two projects: p1 and p2. I can access p1 and p2 from going to http://hostthedocs.mycompany/p1 and http://hostthedocs.mycompany/p2, respectively.
I'm wondering if http://hostthedocs.mycompany/ will show that both p1 and p2 exist.
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.