Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File generation works in development but times out on the server #14

Open
RossLYoung opened this issue May 7, 2017 · 9 comments
Open

Comments

@RossLYoung
Copy link

RossLYoung commented May 7, 2017

  • Templated-docs version: 0.3.1
  • Python version: 2.7.6
  • Operating System: Ubuntu 14.04.5

Description

I can successfully generate .docx files in development (Ubuntu 16.04), but it hangs/times out on when deployed to the server (Ubuntu 14.04).
I have tried LO versions 5.1.6.2 and 5.3.2.2.
Nginx & Gunicorn timeouts are 120s. It will successfully generate the templates in 2-3 seconds on my laptop, so the timeout is not the issue. The processor is idle throughout.

Edit:
It seems I am able to create .odt files, but not .doc. or .docx on the server.

What I Did

I've added logging to every step of process and discovered that it doesn't seem to get past

https://github.com/alexmorozov/templated-docs/blob/master/templated_docs/__init__.py#L92

This would indicate a problem with LO.

On the server, I can successfully convert an .odt file to .docx with the pylokit example...

>>> import os
>>> lo_path = "/usr/lib/libreoffice/program"
>>> with Office(lo_path) as lo:
...     with lo.documentLoad("report_end_of_course.odt") as doc:
...         doc.saveAs("myNewFile.docx")


Is there anything I can try to debug this further?

Thanks

@AnSharypov
Copy link

@RossLYoung Hi
Did you find solution for debuging?

@RossLYoung
Copy link
Author

@AnSharipov
No solution.
As above, everything works in development on the laptop.
On the server templated-docs can't convert odt to doc/docx. It just hangs.
On the server, I can manually convert to doc/docx using the pylokit example.
It's very strange.

@AnSharypov
Copy link

AnSharypov commented May 20, 2017

@RossLYoung
I have the same problem.
I use your way to convert files and it works. How do you download file after its converted?

@minidron
Copy link

I have the same problem.

  • Ubuntu 16.04
  • nginx + uWSGI

After some research, I found the problem. uWSGI runs with uid www-data. Libreoffice can't create .config in HOME directory of www-data user, because www-data don't have permission for that.

I did:

sudo mkdir /home/www-data
sudo usermod -d /home/www-data www-data
sudo chown www-data:www-data /home/www-data

Or you can try:

sudo chown -R www-data:www-data /var/www

It helped me. Sorry for my English. 😊

@AnSharypov
Copy link

Hi @minidron thank you for your help!
I tried both ways, but still getting 502 error.
home and www-data doesn't contain .config file

@minidron
Copy link

@AnSharypov

Try this:

  • create some superuser with home folder and add his to www-data group
  • set his as WSGI HTTP server user: for uWSGI - uid option, for Gunicorn - user option
  • restart WSGI server and try convert

@AnSharypov
Copy link

@minidron I forgot to mention I use Gunicorn

@minidron
Copy link

@AnSharypov If you want, you can write here your email, I send you email with my VK profile and try there help you.

@AnSharypov
Copy link

@minidron https://vk.com/andreysharipov it would be great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants