0

I made a web server using python+django+mysql+iis

server runs fine but when I surf into admin page, I only see texts and links,,not images..the screen capture of my admin page is in the link below. (sorry i don't have enough reputation to post an image..) enter image description here

I'd really appreciate for any help

Thanks!

admin network path

C:\inetpub\wwwroot\swingqa>python manage.py collectstatic

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

    C:\inetpub\wwwroot\swingqa\qablog\static

This will overwrite existing files!
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes
Found another file with the destination path 'admin\css\base.css'. It will be ig
nored since only the first encountered file is collected. If this is not what yo
u want, make sure every static file has a unique path.
Found another file with the destination path 'admin\css\changelists.css'. It wil
l be ignored since only the first encountered file is collected. If this is not
what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\css\dashboard.css'. It will
be ignored since only the first encountered file is collected. If this is not wh
at you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\css\fonts.css'. It will be i
gnored since only the first encountered file is collected. If this is not what y
ou want, make sure every static file has a unique path.
Found another file with the destination path 'admin\css\forms.css'. It will be i
gnored since only the first encountered file is collected. If this is not what y
ou want, make sure every static file has a unique path.
Found another file with the destination path 'admin\css\login.css'. It will be i
gnored since only the first encountered file is collected. If this is not what y
ou want, make sure every static file has a unique path.
Found another file with the destination path 'admin\css\rtl.css'. It will be ign
ored since only the first encountered file is collected. If this is not what you
 want, make sure every static file has a unique path.
Found another file with the destination path 'admin\css\widgets.css'. It will be
 ignored since only the first encountered file is collected. If this is not what
 you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\fonts\LICENSE.txt'. It will
be ignored since only the first encountered file is collected. If this is not wh
at you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\fonts\README.txt'. It will b
e ignored since only the first encountered file is collected. If this is not wha
t you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\fonts\Roboto-Bold-webfont.wo
ff'. It will be ignored since only the first encountered file is collected. If t
his is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\fonts\Roboto-Light-webfont.w
off'. It will be ignored since only the first encountered file is collected. If
this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\fonts\Roboto-Regular-webfont
.woff'. It will be ignored since only the first encountered file is collected. I
f this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\calendar-icons.svg'. It
will be ignored since only the first encountered file is collected. If this is n
ot what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\icon-addlink.svg'. It wi
ll be ignored since only the first encountered file is collected. If this is not
 what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\icon-alert.svg'. It will
 be ignored since only the first encountered file is collected. If this is not w
hat you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\icon-calendar.svg'. It w
ill be ignored since only the first encountered file is collected. If this is no
t what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\icon-changelink.svg'. It
 will be ignored since only the first encountered file is collected. If this is
not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\icon-clock.svg'. It will
 be ignored since only the first encountered file is collected. If this is not w
hat you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\icon-deletelink.svg'. It
 will be ignored since only the first encountered file is collected. If this is
not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\icon-no.svg'. It will be
 ignored since only the first encountered file is collected. If this is not what
 you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\icon-unknown-alt.svg'. I
t will be ignored since only the first encountered file is collected. If this is
 not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\icon-unknown.svg'. It wi
ll be ignored since only the first encountered file is collected. If this is not
 what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\icon-yes.svg'. It will b
e ignored since only the first encountered file is collected. If this is not wha
t you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\inline-delete.svg'. It w
ill be ignored since only the first encountered file is collected. If this is no
t what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\LICENSE'. It will be ign
ored since only the first encountered file is collected. If this is not what you
 want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\README.txt'. It will be
ignored since only the first encountered file is collected. If this is not what
you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\search.svg'. It will be
ignored since only the first encountered file is collected. If this is not what
you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\selector-icons.svg'. It
will be ignored since only the first encountered file is collected. If this is n
ot what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\sorting-icons.svg'. It w
ill be ignored since only the first encountered file is collected. If this is no
t what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\tooltag-add.svg'. It wil
l be ignored since only the first encountered file is collected. If this is not
what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\tooltag-arrowright.svg'.
 It will be ignored since only the first encountered file is collected. If this
is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\gis\move_vertex_off.svg'
. It will be ignored since only the first encountered file is collected. If this
 is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\img\gis\move_vertex_on.svg'.
 It will be ignored since only the first encountered file is collected. If this
is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\actions.js'. It will be i
gnored since only the first encountered file is collected. If this is not what y
ou want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\actions.min.js'. It will
be ignored since only the first encountered file is collected. If this is not wh
at you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\calendar.js'. It will be
ignored since only the first encountered file is collected. If this is not what
you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\cancel.js'. It will be ig
nored since only the first encountered file is collected. If this is not what yo
u want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\change_form.js'. It will
be ignored since only the first encountered file is collected. If this is not wh
at you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\collapse.js'. It will be
ignored since only the first encountered file is collected. If this is not what
you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\collapse.min.js'. It will
 be ignored since only the first encountered file is collected. If this is not w
hat you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\core.js'. It will be igno
red since only the first encountered file is collected. If this is not what you
want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\inlines.js'. It will be i
gnored since only the first encountered file is collected. If this is not what y
ou want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\inlines.min.js'. It will
be ignored since only the first encountered file is collected. If this is not wh
at you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\jquery.init.js'. It will
be ignored since only the first encountered file is collected. If this is not wh
at you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\popup_response.js'. It wi
ll be ignored since only the first encountered file is collected. If this is not
 what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\prepopulate.js'. It will
be ignored since only the first encountered file is collected. If this is not wh
at you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\prepopulate.min.js'. It w
ill be ignored since only the first encountered file is collected. If this is no
t what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\prepopulate_init.js'. It
will be ignored since only the first encountered file is collected. If this is n
ot what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\SelectBox.js'. It will be
 ignored since only the first encountered file is collected. If this is not what
 you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\SelectFilter2.js'. It wil
l be ignored since only the first encountered file is collected. If this is not
what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\timeparse.js'. It will be
 ignored since only the first encountered file is collected. If this is not what
 you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\urlify.js'. It will be ig
nored since only the first encountered file is collected. If this is not what yo
u want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\admin\DateTimeShortcuts.j
s'. It will be ignored since only the first encountered file is collected. If th
is is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\admin\RelatedObjectLookup
s.js'. It will be ignored since only the first encountered file is collected. If
 this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\vendor\jquery\jquery.js'.
 It will be ignored since only the first encountered file is collected. If this
is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\vendor\jquery\jquery.min.
js'. It will be ignored since only the first encountered file is collected. If t
his is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\vendor\jquery\LICENSE-JQU
ERY.txt'. It will be ignored since only the first encountered file is collected.
 If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\vendor\xregexp\LICENSE-XR
EGEXP.txt'. It will be ignored since only the first encountered file is collecte
d. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\vendor\xregexp\xregexp.js
'. It will be ignored since only the first encountered file is collected. If thi
s is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin\js\vendor\xregexp\xregexp.mi
n.js'. It will be ignored since only the first encountered file is collected. If
 this is not what you want, make sure every static file has a unique path.

0 static files copied to 'C:\inetpub\wwwroot\swingqa\qablog\static', 62 unmodifi
ed.
  • http://stackoverflow.com/questions/40003898/django-admin-not-serving-static-files-on-apache/40012958#40012958 hth :) – cutteeth Nov 17 '16 at 07:47
  • hi cutteeth, I tried to do like the link you gave me but it doesn't seem to work.. I copied the static files in C:\Python34\Lib\site-packages\django\contrib\admin\static\admin this path and pasted into C:\inetpub\wwwroot\swingqa\qablog\static\admin here... Did I do something wrong? I really appreciate if you reply..thanx – cherrylatte Nov 17 '16 at 09:03
  • Is your app in local or deployment server? – cutteeth Nov 17 '16 at 10:16
  • I'm a newbie in making this web server. I'm not sure but I think it's a deployment server....my app is in C:\inetpub\wwwroot\swingqa location – cherrylatte Nov 18 '16 at 04:10

4 Answers4

0

Try running the command python manage.py collectstatic

Kishan Mehta
  • 2,598
  • 5
  • 39
  • 61
  • Do right click and " inspect element " on this page and show the paths from the network tab. – Kishan Mehta Nov 18 '16 at 05:24
  • sorry to ask again but, which path should I show you? There are too many things listed :-( – cherrylatte Nov 18 '16 at 06:50
  • Can you show the paths which has errors 404 ? Screenshot will be fine – Kishan Mehta Nov 18 '16 at 06:52
  • I added the image link "network path" ..when I reload this stackoverflow page there was no 404 errors so I just posted 204 error instead.. – cherrylatte Nov 18 '16 at 07:10
  • I was talking about your admin page that is in question my friend not this stack overflow page. – Kishan Mehta Nov 18 '16 at 07:13
  • oops! sorry! I added again! :-) – cherrylatte Nov 18 '16 at 07:33
  • Np. See base.css and login.css has 404 howerover them and check those full paths. Also set your static_root in settings.py file according to that. Can you show your static_root in your settings.py file? When you do collecstatic it goes to path you specify in your static_root so that is where the problem is. – Kishan Mehta Nov 18 '16 at 08:02
  • I see...my static root and static url in setting.py is..... STATIC_URL = '/static/' STATIC_ROOT = 'C:\inetpub\wwwroot\swingqa\qablog\static' – cherrylatte Nov 18 '16 at 08:28
  • I am sure your full path on admin page for base.css is C:\inetpub\wwwroot\swingqa\static' without qablog ?? plz check and tell me. If yes change your static_root to correct path ie. (C:\inetpub\wwwroot\swingqa\qablog\static') and try collectstatic command again. :) – Kishan Mehta Nov 18 '16 at 08:35
  • my full path for base.css is C:\inetpub\wwwroot\swingqa\qablog\static\admin\css ....Then how should I change static_root?? – cherrylatte Nov 18 '16 at 09:14
  • sorry but I actually don't understand the last comment of yours – cherrylatte Nov 18 '16 at 09:27
  • Ok So what is the output of python manage.py collectstatic command ?? which path it is copying the files? – Kishan Mehta Nov 18 '16 at 09:39
  • sorry for late reply, I added the output of python manage.py collectstatic command – cherrylatte Nov 21 '16 at 00:31
0

Ok, listen! First,You need to write in your settings.py

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

Later, you can run the collectstatic command to save the differnts admin static files in the right folder.

you will need as well as setting up your server to serve static files, I don't know what is the correct configuration in the iis but you can find the apache configuration in this link.

https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/modwsgi/

Finally, you have to put your urlpatterns like this.

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'',include(api_urls)),
    url(r'^api-token-auth/', obtain_jwt_token),
    url(r'^api-token-verify/', verify_jwt_token),
]+static(settings.STATIC_URL,document_root = settings.STATIC_ROOT)

Try this, comments your results and we will help you!

Good Luck!

JuanB
  • 180
  • 1
  • 5
  • I didn't do anything to iis configuration file since I couldn't figure out the problem of my config file but I did change the settings.py and urls.py (C:\inetpub\wwwroot\swingqa\swingqa\urls.py) and I got..weird result in my page..it says NameError at / name 'admin' is not defined – cherrylatte Nov 21 '16 at 06:47
  • I think I missed something is setting iis configuration file.. I think I should figure this out. I have a similar problem like the below link. http://stackoverflow.com/questions/32312590/how-to-fetch-static-css-files-with-django-on-iis but..I tried to solve like the solution...but it doesn't work.. – cherrylatte Nov 21 '16 at 07:55
  • Thank you I solved the problem. it was related to the conguration – cherrylatte Nov 21 '16 at 11:04
0

I solved the problem!! First I changed my settings.py file like below

STATIC_URL = '/static/'
STATIC_ROOT = os.path.abspath(os.path.join(os.path.dirname(file), 'static')) STATICFILES_DIRS = (os.path.join('static'), )

Second, I edited my iis by looking into these three below

  1. Django Static Files - 404
  2. What are the problems with loading CSS and JS from Django to IIS7?
  3. How to fetch static CSS files with django on IIS?

I actually followed the steps exactly like the third answer except that I used the web config file like below and I put that under C:\inetpub\wwwroot\myprojectname\static folder

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <!-- 
      This removes Helicon Zoo handler and makes IIS processing static files.
      -->
      <remove name="django.project#x64" />
      <remove name="django.project#x86" />
    </handlers>
  </system.webServer>
</configuration>

I am truly thankful for people who helped me out especially soupboy, auros132, and cutteeth. Thank you guys for the support!

Community
  • 1
  • 1
0

If you look at the server console, you'll probably see some 404 errors. You need to enable DEBUG=True on your settings.py file, although according to Django docs, this is NOT recommended on production, and should only be used on the dev environment.

tadf2
  • 11
  • 3