服務器在本地服務器上的Ubuntu 16.04.2 x64上啓動,所有的工作設置都與只在這裏啓動的相同,無法找到它們!Django staticfiles 404部署到數字海洋
設置
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^chart/', include("charts.urls", namespace='charts')),
url(r'^comments/', include("comments.urls", namespace='comments')),
url(r'^im/', include("messenger.urls", namespace='im')),
url(r'^accounts/', include("accounts.urls", namespace='accounts')),
url(r'^series/', include("serials.urls", namespace='series')),
url(r'^', include("serials.urls", namespace='homeview')),
]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
在本地服務器上的一切
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
#'/var/www/static/',
]
STATIC_ROOT = os.path.join(BASE_DIR, "static_cdn")
MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, "media_cdn")
網址的偉大工程,但是當我在現場staticfiles啓動它沒有找到
> [29/Jul/2017 07:54:38] "GET /static/css/bootstrap.min.css HTTP/1.1"
> 404 102 [29/Jul/2017 07:54:38] "GET /static/js/bootstrap.min.js
> HTTP/1.1" 404 100 [29/Jul/2017 07:54:38] "GET
> /static/min_css/base.min.css HTTP/1.1" 404 101 [29/Jul/2017 07:54:38]
> "GET /static/js/Chart.min.js HTTP/1.1" 404 96 [29/Jul/2017 07:54:38]
> "GET /static/js/smooth-scroll.js HTTP/1.1" 404 100 [29/Jul/2017
> 07:54:38] "GET /static/js/script.js HTTP/1.1" 404 93 [29/Jul/2017
> 07:54:39] "GET /static/js/bootstrap.min.js HTTP/1.1" 404 100
> [29/Jul/2017 07:54:39] "GET /static/js/Chart.min.js HTTP/1.1" 404 96
> [29/Jul/2017 07:54:39] "GET /static/js/smooth-scroll.js HTTP/1.1" 404
> 100 [29/Jul/2017 07:54:39] "GET /static/js/script.js HTTP/1.1" 404 93
如何配置服務器? – InvictusManeoBart
你使用什麼網絡服務器? Nginx還是Apache? –
我使用Nginx服務器 – InvictusManeoBart