Sphinx docs displaying locally but not at URL when pushed to GitHub - python

I generated Python docs using Sphinx using make html. When I opened index.html in my browser the docs displayed as expected and all links worked as expected.
I then committed all docs and pushed to a branch in GitHub.
When I access the url https://<my company>.github.io/<my repo>/ the page displays but the CSS isn't working and some of the links do not work. Does anybody know why this might be?

The problem was that some files were missing. After reading this I added an empty .nojekyll which resolved the issue.

Related

nbdev-tutorial: nbdev_build_docs & Github Pages not working properly

Good evening,
following the nbdev tutorial (Klick) from scratch i could not get the hosted documentation to look nice. Also the link to an exisiting module is missing.
Github pages output:
Github repo that stores this project:
(Klick)
The weird thing is that everything works just fine (no errors), still the rendered Github page looks much nicer in the tutorial.

How to fix image is not showing in heroku deployed django app

I have a Blog created with Django 3.x. When I run the project on my local server then it works fine. So, I deployed my project to heroku and here is the link bblog-shovon.herokuapp.com/. Then the project was working fine. My project git link https://git.heroku.com/bblog-shovon.gitThen I created a post and then I gave it a thumbnail and finally everything was fine. But, After sometime when i revisit the site then every image were gone. I didn't found them. And when I tried to open the image on another tab then it shows this Error message screenshot. When I am writing this question then I created a new post and after publishing this this posts image is working. But, older image is not working.
Then, How can i fix this problem? Please help me!!
Heroku flushes the filesystem to the latest commit. So you will have to use third-party plugins such as AWSBucket, etc.
With Heroku the filesystem is not persisted so you will lose media files occasionally. Use S3 or some other provider to store your user-uploaded media (also your static files if you want, otherwise use whitenoise). Django-storages makes it very easy.

Convert PDF to HTML without losing any format

I'm developing a Python Flask webapp and I'm trying to convert some user uploaded pdfs to nicely formatted HTML, like the HTML that is being produced when you display a pdf inside an iframe.
I tried several things so far:
the pdfminer.six library, produced messy HTML,
trying to grab the produced HTML, when rendering a PDF with pdf.js, which is apparently hidden in a Shadow DOM with no access to its inner HTML
finally I came across pdf2htmlEX (https://github.com/pdf2htmlEX/pdf2htmlEX) which produced exactly what I wanted.
Locally, this solution worked great, however in the production state (Heroku) I was unable to install it correctly. The project is deprecated and the documentation is limited and terrible. The problem has something to do with broken dependencies.
So, how to convert PDFs to HTML effectively without losing any format using Python or any other tool?
Thanks a lots.
if anyone is willing to help me getting the pdf2htmlEX to work on heroku, leave a comment and I will post more details in a different post
This is not going to be trivial. But I'll give some pointers.
You need an app.json in which you define your buildpacks.
https://devcenter.heroku.com/articles/app-json-schema#buildpacks
If this project is available via apt it's going to be easy. You just use the Heroku's Apt buildpack define an Aptfile that says which packages it needs to install. Example
Then it installs it automatically and you are done.
If it is not available as a package you will need to create your own buildpack.
https://devcenter.heroku.com/articles/buildpack-api
Example used here.
Another solution is to dockerize your project and execute it as a docker container.

Django documentation on development server using Sphinx CSS not working

I'm trying to combine Sphinx on my Django development server. I know i could better use apache. But I can't use apache due to the fact that the project will be managed by someone else and the project needs to work as simple as possible. Without too many external libraries etc.
So i tried django-docs package and django.static.serve in my url. The HTML pages work, only the look of the pages is just plain html so the CSS isn't included. The documentation on django-docs is really bad and i can't seem to get it to work with the static files Sphinx created. I can't use sphinxdocs as well since it needs haystacks which will add to my external libraries.
I added django-docs to my installed apps and added this to my settings. With projectpath being the path to where my conf.py is located. I'm not sure if the location is right though. But the documentation isn't really clear at what i should fill in on the project path part. And i added the urls in my urlspatterns
DOCS_ROOT = os.path.join(PROJECT_PATH, '../docs/_build/html')
DOCS_ACCESS = 'staff'
url(r'^docs/', include('docs.urls')),
In sphinx doc the static files are located in the docs/_build/html/_static
I found the problem If anyone else has the issue. I had some other folders called static inside my docs folder. When i removed them it worked. So it was just me being a bit stupid.

how to port python sphinx-doc to github pages?

I just followed How to upload html documentation generated from sphinx to github? and everything works fine until I uploaded it to my github. I intend to make it as my personal website and I didn't make gh-pages branch. It looks something like this:
but it should look something like this, which I look from local:
Does anyone know what went wrong? I did include ".nojekyll" in the root. All the files generated directly from make html (however, I didn't upload files in "doctree"; only files in "html")
Thanks much!
The file name should be .nojekyll not .nojekyII :(

Categories