简体   繁体   中英

Static files not working in Iframe in production mode django

In production mode my django project1 working fine.

settings.py

DEBUG = False
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
STATIC_ROOT = os.path.join(BASE_DIR,'mysite' ,'static') 
STATICFILES_DIRS = [
  os.path.join(BASE_DIR, 'mysite',  "static"),
  '/var/www/static/',
]

I ran this project in localhost:8000

And my different project(project2) which is running into localhost:8001

I want to show project1's home page in project2 using iframe or embed but project1's static files not working here.

try with:

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
    '/var/www/static/',
)

and set debug to true, if you set debug to false then run manage.py --insecure . The reason: If you set debug to true then you server will take care the staticfiles and not the Django server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM