Code Monkey home page Code Monkey logo

hostthedocs's People

Contributors

abrasive avatar alertedsnake avatar allebacco avatar and2345 avatar dougthor42 avatar iwootten avatar joge97 avatar nathanaelhuffman avatar rgalanakis avatar tagc avatar wcpannell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

hostthedocs's Issues

Cross project search

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

Sorting exception when part of project version contains alpha when others do not

Summary

If a project version has an alpha char in the version somewhere, the sorting fails.

Steps to Reproduce

  1. Create a project and start HostTheDocs server.
  2. Upload the project with version = 0.0.1
  3. Upload the project with version = 0.0.2a
  4. Navigate to HostTheDocs page.
  5. See Internal Server Error if running on Apache + WSGI or see exception if running in debug.
  6. Rename hostthedocs/static/docfiles/project/0.0.2a to hostthedocs/static/docfiles/project/0.0.2 (removing the alpha from the folder name
  7. Navigate to HostTheDocs page.
  8. See everything is working fine.

Comments

Looks like it's an easy enough fix, but there needs to be discussion:

  • Should the alpha be removed and then just sort by int?
  • Should the sorting be changed to alpha sorting?
    • if so, just for that part of the version?
    • or for the entire version string?
  • Should there be warning when trying to upload a file with a version string that will break things?
  • I haven't tested it yet, but based on the source code it looks like if there always is an alpha char in that slot of the version, then it will sort fine. For example, these will probably sort fine:
    • 0.1.a
    • 0.1.b
    • 0.1.c

Logs

apache/error.log

[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]

Cannot run under Python 3.5.2 - "TypeError: 'generator' object is not subscriptable"

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.

302 redirects from latest aren't working?

@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?

Linking to latest doesn't work

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 -

User/Pass

Is login is in the roadmap for this project? Strict requirement for my use case.

Decouple the Project Name from the Project URL (add a "url_name" parameter)

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:
image
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.

New Features Discussion: Embed docs as iframe (and a few others)

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:

  • Add support for URL prefix / application root - for example, everything is hosted under /docs/
  • Add upload page that wraps /hmfd
  • Add nav bar with link to home and upload pages
  • Embed actual uploaded docs as an iframe, so that we have a navbar and can always get back home

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.