python安装django找不到set.up_Python django LRS無法設置。找不到文件錯誤

I am using ADL LRS to setup a LRS(Learning Record Store) system for my own use. It uses TIN CAN API. I am using ubuntu server

我正在使用ADL LRS來設置我自己使用的LRS(學習記錄存儲)系統。它使用TIN CAN API。我正在使用ubuntu服務器

As the documentation states, For the setup of LRS, I need to install django adn set it up for LRS. The adl_lrs folder inside the ADL_LRS contains the setting file for django(settings.py). I am bit new to django, so I can not fully understand the meaning of this part of the file-

正如文檔所述,對於LRS的設置,我需要安裝django adn為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.

)

It states- 1. MEDIA_ROOT = '/var/www/adllrs/media/' which I assume it means is to put the media files like songs and videos, at this location 2. STATIC_ROOT = '' which I assumes means the path of the static directory which contains the HTML, CSS, js files.

它聲明 - 1. MEDIA_ROOT ='/ var / www / adllrs / media /',我認為這意味着將媒體文件如歌曲和視頻放在這個位置2. STATIC_ROOT =''我假設的意思是路徑包含HTML,CSS,js文件的靜態目錄。

On cloning the git, I setup the LRS, which by the way started but all the CSS broken. I looked into DOM inspector, where the link of CSS files are like-

在克隆git時,我設置了LRS,順便說一下,但是所有的CSS都被破壞了。我查看了DOM檢查器,其中CSS文件的鏈接是 -

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

When I visited the above url to see what's happening, I got following output as HTML(same as I get when visiting homepage, i.e

當我訪問上面的網址看看發生了什么時,我得到了以下輸出為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.

My urls.py looks like-

我的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))

Obviously I am not mentioning my home page in the urls.py which point to the error. So where should I put the CSS,JS files to get the broken CSS fixed and make a default home page for this? and also I have tried to send tin can statements from wordpress, but I could not get the statements on my server. can anyone tell me how to setup a proper ADL LRS on ubuntu.

顯然我沒有在urls.py中提到我的主頁,指出錯誤。那么我應該在哪里放置CSS,JS文件來修復破壞的CSS並為此創建一個默認主頁?而且我也嘗試從wordpress發送錫罐語句,但我無法在我的服務器上獲取語句。任何人都可以告訴我如何在ubuntu上設置正確的ADL LRS。

PS- Do not tell me to read the documentation as I have done it like dozen times. Tell me where I am wrong in implementing the documentation.

PS-不要告訴我閱讀文檔,因為我已經做了十幾次。告訴我在實施文檔時我的錯誤。

1 个解决方案

#1

1

It sounds like you have the LRS running with just gunicorn. gunicorn by itself doesn't serve static files like the JS and CSS. I found another SO page talking about serving static files with gunicorn: https://stackoverflow.com/a/12801140/1187723

聽起來你的LRS只用槍炮就可以了。 gunicorn本身不提供像JS和CSS這樣的靜態文件。我發現另一個SO頁面談論用gunicorn提供靜態文件:https://stackoverflow.com/a/12801140/1187723

As for the LRS, when I am developing and testing locally I run Django's test server, which will deliver static files. From the project's root directory ADL_LRS, start it with python manage.py runserver. https://docs.djangoproject.com/en/1.4/ref/django-admin/#runserver-port-or-address-port

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

When we deploy the LRS at https://lrs.adlnet.gov/xapi/ we use nginx, which is configured to serve the static files. We have some initial set up stuff about it at https://github.com/adlnet/ADL_LRS/wiki/Using-Nginx-for-Production

當我們在https://lrs.adlnet.gov/xapi/部署LRS時,我們使用nginx,它被配置為提供靜態文件。我們在https://github.com/adlnet/ADL_LRS/wiki/Using-Nginx-for-Production上有一些關於它的初步設置

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值