2016-11-17 7 views
0

Я сделал веб-сервер с помощью питон + Джанго + MySQL + IisДжанго страницу администрирования отображать только тексты и ссылки

сервер работает нормально, но когда я занимаюсь серфингом на странице администратора, я вижу только тексты и ссылки ,, нет изображений ..Запись экрана моей страницы администратора находится по ссылке ниже. (жаль, что я не хватает репутации, чтобы отправить изображение ..) enter image description here

Я бы очень признателен за любую помощь

Спасибо!

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. 
+0

http://stackoverflow.com/questions/40003898/django-admin-not-serving-static-files-on-apache/40012958#40012958 hth :) – cutteeth

+0

hi cutteeth, я попытался сделать, как ссылку, которую вы дали но это, похоже, не работает. Я скопировал статические файлы в C: \ Python34 \ Lib \ site-packages \ django \ contrib \ admin \ static \ admin этот путь и вставил в C: \ inetpub \ wwwroot \ swingqa \ qablog \ static \ admin здесь ... Я сделал что-то не так? Я очень благодарен, если вы ответите .. thanx – cherrylatte

+0

Является ли ваше приложение локальным или сервером развертывания? – cutteeth

ответ

0

Я решил проблему !! Сначала я изменил мой settings.py файл, как показано ниже

STATIC_URL = '/ статический /'
STATIC_ROOT = os.path.abspath (os.path.join (os.path.dirname (файл) 'статический')) STATICFILES_DIRS = (os.path.join ('статический'))

во-вторых, я редактировал мои IIS, глядя в эти три ниже

  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?

Я на самом деле следуют шаги так же, как третий ответ, за исключением того, я использовал файл веб-конфигурации, как показано ниже, и я положил, что в C: \ Inetpub \ Wwwroot \ myprojectname \ статические папка

<?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> 

Я действительно благодарен людям, которые помогли мне особенно soupboy, auros132 и cutteeth. Спасибо, ребята, за поддержку!

0

Попробуйте выполнить команду python manage.py collectstatic

+0

Я тоже это сделал, но он не работает :-( – cherrylatte

+0

Сделайте правый щелчок и «проверить элемент» на этой странице и показать пути с вкладки в сети. – Kishan

+0

жаль снова спрашивать, но какой путь я должен вам показать? Есть слишком много вещей, перечисленных :-( – cherrylatte

0

Ok, слушай! Во-первых, Вам нужно написать в вашем settings.py

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

Позже вы можете запустить collectstatic команду, чтобы сохранить differnts Admin статические файлы в нужную папку.

вам нужно, а также настроить сервер для обслуживания статических файлов, я не знаю, какая именно конфигурация в iis, но вы можете найти конфигурацию apache в этой ссылке.

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

Наконец, вы должны поставить свои urlpatterns, как это.

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) 

Попробуйте это, комментируйте ваши результаты, и мы поможем вам!

Удачи!

+0

Я ничего не делал с файлом конфигурации iis, так как не мог понять проблему моего конфигурационного файла, но я изменил параметры settings.py и urls.py (C: \ inetpub \ wwwroot \ swingqa \ swingqa \ urls.py), и я получил..вещий результат на моей странице .. говорит, что NameError at/ имя 'admin' не определен – cherrylatte

+0

Я думаю, что я что-то пропустил устанавливает файл конфигурации iis. Думаю, я должен это понять. У меня аналогичная проблема, как в приведенной ниже ссылке. http://stackoverflow.com/questions/32312590/how-to-fetch-static-css-files-with-django-on-iis but..I пытался решить, как решение ... но он не работает .. – cherrylatte

+0

Спасибо, я решил проблему. это было связано с конгузией – cherrylatte