Static file error on Django windows server

31 Views Asked by At

I installed my project on Windows server, but it cannot see the static files.

I tried many examples on the internet, but I could not solve the problem. please guide me on this

Settings.py

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


#STATICFILES_STORAGE = 'whitenoise.storage.CompressedStaticFilesStorage'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

urls.py

path('sitemap.xml', sitemap, {'sitemaps': sitemaps},     name='django.contrib.sitemaps.views.sitemap'),
]
+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) 
+ static(settings.MEDIA_URL, document_root=settings.STATIC_ROOT)


if settings.DEBUG:
   urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

python manage.py collectstatic This is the result I get when I do it:

You have requested to collect static files at the destination
location as specified in your settings:

C:\inetpub\vhosts\demo.com.tr\httpdocs\static
This will overwrite existing files!
Are you sure you want to do this?

Type ‘yes’ to continue, or ‘no’ to cancel: yes

0 static files copied to ‘C:\inetpub\vhosts\demo.com.tr\httpdocs\static’, 126 unmodified.
0

There are 0 best solutions below