2013-04-10 60 views
1

我正在使用ADL LRS來設置一個LRS(學習記錄存儲)系統供我自己使用。它使用TIN CAN API。我正在使用Ubuntu的服務器Python django LRS無法設置。文件未找到錯誤

正如文檔所述,對於LRS的設置,我需要安裝django並將其設置爲LRS。 ADL_LRS中的adl_lrs文件夾包含django(settings.py)的設置文件。我有點新的Django的,所以我不能完全理解的文件 -

# Absolute filesystem path to the directory that will hold user-uploaded files. 
# Example: "/home/media/media.lawrence.com/media/" 
MEDIA_ROOT = '/var/www/adllrs/media/' 

# URL that handles the media served from MEDIA_ROOT. Make sure to use a 
# trailing slash. 
# Examples: "http://media.lawrence.com/media/", "http://my-site-name.com/media/" 
MEDIA_URL = '' 

# Absolute path to the directory static files should be collected to. 
# Don't put anything in this directory yourself; store your static files 
# in apps' "static/" subdirectories and in STATICFILES_DIRS. 
# Example: "/home/media/media.lawrence.com/static/" 
STATIC_ROOT = '' 

# URL prefix for static files. 
# Example: "http://media.lawrence.com/static/" 
STATIC_URL = '/static/' 

# Additional locations of static files 
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static". 
    # Always use forward slashes, even on Windows. 
    # Don't forget to use absolute paths, not relative paths. 
) 

這部分據明─ 1. MEDIA_ROOT = '/var/www/adllrs/media/'的意思,我認爲它的意思是把媒體文件,如歌曲,視頻,在這個位置 2.我假設的STATIC_ROOT = ''表示包含HTML,CSS,js文件的靜態目錄的路徑。

在克隆git時,我設置了LRS,順便啓動了,但所有的CSS都被破壞了。我看着DOM督察,在那裏當我訪問上述網址,看看發生了什麼的CSS文件的鏈接都喜歡 -

http://my-site-name.com:8000/static/admin/css/base.css 

,我得到了以下的HTML(輸出相同的,因爲我得到訪問網頁時,即http://my-site-name.com:8000) -

Page not found (404) 
Request Method:  GET 
Request URL: http://my-site-name.com:8000/ 

    Using the URLconf defined in adl_lrs.urls, Django tried these URL patterns, in this order: 

     ^XAPI/ 
     ^xapi/ 
     ^admin/ 

    The current URL, , didn't match any of these. 

我urls.py看起來屆喜歡 -

url(r'^XAPI/', include('lrs.urls')), 
url(r'^xapi/', include('lrs.urls')), 

# Uncomment the admin/doc line below to enable admin documentation: 
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')), 

# Uncomment the next line to enable the admin: 
url(r'^admin/', include(admin.site.urls)) 

顯然我不提我的主頁e urls.py指向錯誤。那麼我應該在哪裏放置CSS,JS文件來修復已損壞的CSS併爲此創建默認主頁?而且我也試圖從wordpress發送錫罐語句,但我無法在我的服務器上獲得這些語句。任何人都可以告訴我如何在Ubuntu上設置適當的ADL LRS。

PS-不要告訴我閱讀文檔,因爲我已經做了十次。告訴我在實施文檔時我錯了什麼。

回答

1

這聽起來像你有LRS運行只是gunicorn。 gunicorn本身並不提供像JS和CSS這樣的靜態文件。我發現另一個SO頁面談論服務靜態文件與gunicorn:https://stackoverflow.com/a/12801140/1187723

至於LRS,當我在本地開發和測試我運行Django的測試服務器,它將提供靜態文件。從項目的根目錄ADL_LRS中,以python manage.py runserver開始。 https://docs.djangoproject.com/en/1.4/ref/django-admin/#runserver-port-or-address-port

當我們在https://lrs.adlnet.gov/xapi/上部署LRS時,我們使用配置爲服務靜態文件的nginx。我們有一些初步設置的東西在https://github.com/adlnet/ADL_LRS/wiki/Using-Nginx-for-Production