1

I am implementing xhtml2pdf module for my django app. I have been able to print reports, however I am not getting my static configuration to work. I am getting error

SuspiciousFileOperation at /moc-content/165/print-report

The joined path (/moc/static/moc/main.css) is located outside of the base path component (/Users/xxx/Documents/django-projects/MOC/env/lib/python3.10/site-packages/django/contrib/admin/static)

I have implemented link_callback function as xhtml doc is suggesting, but could not figure it out whats wrong with my settings:

# settings.py

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.1/howto/static-files/

STATIC_ROOT = os.path.join(BASE_DIR, 'moc/static')
STATIC_URL = 'moc/static/'

# Media files (uploads)
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = 'moc/media/'

My xhtml functions are as per official docs

My vs code directory tree https://i.stack.imgur.com/FWGuv.png

SS_SS
  • 63
  • 7
  • Does this answer your question? [Django: How to allow a Suspicious File Operation / copy a file](https://stackoverflow.com/questions/22019371/django-how-to-allow-a-suspicious-file-operation-copy-a-file) – Ankit Tiwari Dec 04 '22 at 10:54

0 Answers0