1

The website displays to localhost without css, js, or images.

I setup Windows IIS according to this blog including the final section about static files. The methods outlined are similar to answers from this question, this question, this blog, and this youtube video on how to serve static files from django with IIS.

UPDATE: The problem may be coming from my virtual environment. This project was developed with Anaconda. When I followed the listed tutorials I simply used the paths to my conda venv and didn't think anything of it since the localhost loaded without errors. At the time python was only present on my machine in the anaconda environment, so if manage.py was able to execute and database data was accessed and displayed(without css/js) then I presumed this was not an issue. I am currently trying to interpret this blog on how to setup Anaconda for IIS 8.5 to see if I need to make additional changes to IIS 10. I have not had any luck using web.config files and have had to accomplish the same goals through IIS manager. Jalpa Panchal's comment lead me to investigate the environment.

Any ideas on what additional changes need to be made for IIS 10 to interpret an Anaconda(conda 4.8.3) developed django application?

ORIGINAL POST:

Django settings:

STATIC_URL = "/static/"

STATIC_ROOT = os.path.join(BASE_DIR, 'static') # tested in shell, it is where I expect at the same level as manage.py

The directory "static" was created with manage.py collectstatic in the expected STATIC_ROOT location with all of the static files contained

IIS Manager:

The static directory was then added as a virtual directory: Virtual static directory's advanced settings

Then I removed the django handler I created from the static directory's handler mappings: Virtual static directory's handler mapping

I unlocked the handlers at the root: enter image description here

The django application did display properly, with static files, when I tried using Wampserver w/ Apache and mod_wsgi. Unfortunately, it appears windows IIS will be the better solution for other unrelated reasons. Not too mention Wampserver is a development server, not a production server.

I defined a path for the environment variable WSGI_LOG, the logs generated have no errors. Just states wfastcgi.py was initialized and will restart when there are changes to the files in my project

What else can I be missing that would prevent my static files from being processed?

dpoiesz
  • 113
  • 1
  • 8
  • which iis feature you installed and if you want to server the Django application from iis you need to configure the module in iis. https://learn.microsoft.com/en-us/visualstudio/python/configure-web-apps-for-iis-windows?view=vs-2019 – Jalpa Panchal Apr 10 '20 at 05:51
  • @JalpaPanchal, I believe all those configurations have been made. However, as I was investigating your link to make sure I wasn't missing anything I realized my environment may be causing a problem and am updating my post. Thank you. – dpoiesz Apr 10 '20 at 16:44
  • Do you have two `web.config` files? There should exist one at `C:/inetpub/wwwroot` and one at `C:/inetpub/wwwroot//static/` – Jon May 23 '20 at 05:30

0 Answers0