Django xhtml2pdf - django

Does xhtml2pdf has bugs while using in Django 4.1.1? I am not able to display
<pdf:pagenumber/>
, nor
<pdf:pagecount/>
I am struggling to get my static files load too, I am getting SuspiciousFileOperation error.

Related

Django Weasyprint Timeout error for loading images in log

and I made a project that takes some pictures and converts them to pdf using weasyprint library. everything is alright in localhost but when I deployed it in python anywhere it generates the pdf but pictures that supposed to be in it dosent display and just the replace string of them is in the pdf please help me
Weasyprint might not be able to load the pictures. Check that the URLs you give can be accessed by Weasyprint. When in doubt, try using data URIs which don't require loading over the network.

How can I create a video and photo uploading feature on my website using Python and Django?

How can I create a video and photo uploading feature on my website using Python and Django?
I have using forms,models(file_field) and yet it doesn't render to the front_end
If you're using ImageField to upload to the server, make sure you have pillow installed. Your python may just be looking at a wrong path to search for your files. Secondly, you might want to consider your markup code, and make sure that there is space for your video to be uploaded. ie) , etc..

Configuring django-tinymce-filebrowser with django-tinymce doesn't work

I am using django tinymce for a text field in django form. It is not admin based.
For inserting images, I tried django-tinymce-filebrowser. It is giving me following error in firefox error console in tiny_mce.js file:
TypeError: p is undefined
Also the browse button displays link to following javascript function:
openBrowser('srcbrowser','src','image','theme_advanced_image_image_browser_callback')
I am not getting from where it is coming.
My settings.py looks like this:
TINYMCE_DEFAULT_CONFIG = {
...
'file_browser_callback': 'mce_filebrowser'
}
I tried searching for django-tinymce-filebrowser examples but nothing much is available. Most of the documentation is for django filebrowser which work in admin only.
Does anyone has clue how to configure this filebrowser?

Submitting ImageFields in Django Admin doesn't work

I have some models with ImageFields (that work fine on my home computer test environment). When I put the project on a server using Passenger WSGI, submitting a form in the admin containing an ImageField doesn't work.
If DEBUG is True, I get a 404 error page saying that it can't find 500.shtml (I didn't create a 500 error page). No error appears in the server console.
If DEBUG is False, I get an Apache message saying it can't find "admin/red_projects/project/add/" (the URL it was JUST at), and the server error log has a message saying that the folder admin doesn't exist in the filesystem (since it's not a directory, just a Django urlconf), or it just hangs and doesn't load the page.
I already recursively set the permissions on the media directory to 755, and that didn't do anything. Everything else works fine, including submitting admin forms without ImageFields.
Django dosn't serve media or static files when debug is False, you shoud have and alias in your configuration to serve them via the web server directly (Way faster than using django to serve them)
Read this, it will help you put it in production : Deploying static files
Edit: This is for static files, same things aply to media files

Admin media disappear while running django trunk in development mode

I got into django recently and start playing around with the tutorials & documentation (with the development version). Everything has been fine till I decide to update again to the latest django trunk and well my admin media are not showing up at all!
After some troubles, I managed to get admin media showing by commenting out django.contrib.staticfiles. However as I do use the staticfiles app to manage my site static files, I need it to be enabled. After some troubles, I manage to get both admin media and staticfiles showing by using manage.py collectstatic to collect the admin media files to my static folder.
However is there a way for me to serve admin media in DEBUG mode easily like last time without using collect static command? as I don't want to call the collectstatic every time when django admin media files got changed in trunk? (though I don't know how often/rare that is)
Django trunk is changing how static files are served, and in fact new changes landed this morning.
You'll want to get latest again, and then start here: http://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/