2017-08-11 32 views
0

繼一堆教程,我寫我的第一個Django應用程序,然後決定部署它的Linode服務器上。在their tutorial之後,我只有這麼遠。我能說的最好的是,它基於Ubunto的早期版本,並嘗試了其他一些方法,包括uwsgi快速入門教程。uwsgi + Django的+ nginx的:Python應用程序不加載

我得到了足夠遠的命令「蟒蛇manage.py runserver命令」將成爲我的網站,並想移動到使用uwsgi做同樣的。

它好像有一些環境變量的缺失。當我嘗試在命令行啓動uwsgi有:

uwsgi --http :8000 --module dynamicefl.wsgi 

我得到如下:

*** Starting uWSGI 2.0.15 (64bit) on [Fri Aug 11 19:37:04 2017] *** 
compiled with version: 6.3.0 20170406 on 10 August 2017 23:41:13 
os: Linux-4.9.36-x86_64-linode85 #1 SMP Thu Jul 6 15:31:23 UTC 2017 
nodename: roosevelt 
machine: x86_64 
clock source: unix 
detected number of CPU cores: 1 
current working directory: /home/django/worksheets/dynamic-efl 
detected binary path: /usr/local/bin/uwsgi 
!!! no internal routing support, rebuild with pcre support !!! 
*** WARNING: you are running uWSGI without its master process manager *** 
your processes number limit is 3941 
your memory page size is 4096 bytes 
detected max file descriptor number: 1024 
lock engine: pthread robust mutexes 
thunder lock: disabled (you can enable it with --thunder-lock) 
uWSGI http bound on :8000 fd 4 
spawned uWSGI http 1 (pid: 5998) 
uwsgi socket 0 bound to TCP address 127.0.0.1:43637 (port auto-assigned) fd 3 
Python version: 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] 
*** Python threads support is disabled. You can enable it with --enable-threads *** 
Python main interpreter initialized at 0x562bdad6fda0 
your server socket listen backlog is limited to 100 connections 
your mercy for graceful operations on workers is 60 seconds 
mapped 72760 bytes (71 KB) for 1 cores 
*** Operational MODE: single process *** 
Traceback (most recent call last): 
    File "./dynamicefl/wsgi.py", line 12, in <module> 
    from django.core.wsgi import get_wsgi_application 
ImportError: No module named django.core.wsgi 
unable to load app 0 (mountpoint='') (callable not found or import error) 
*** no app loaded. going in full dynamic mode *** 
*** uWSGI is running in multiple interpreter mode *** 
spawned uWSGI worker 1 (and the only) (pid: 5997, cores: 1) 

很多教程強調把路徑虛擬環境中的.ini文件,我做了(與「ENV」雙重檢查,我有虛擬環境的權利。)這是我與

[uwsgi] 
home = /home/django/Env/worksheets 
chdir = /home/django/worksheets/dynamic-efl/dynamicefl 
module = dynamicefl.wsgi::application 

uid = www-data 
gid = www-data 
socket = localhost:9191 
chmod-socket = 644 
chown-socket = www-data 

processes = 4 
threads = 2 
logto = /var/log/uwsgi.log 

我已經與改變CHDIR命令的一些實驗工作的.ini文件,如我m no牛逼確定究竟在何處應指向,但它指向regarless的結果類似的線uwsgi.log:

-- no python application found, check your startup logs for errors --- 

(有趣的事實:我一直沒能找到參考uwsgi啓動日誌)

如果我去的網站在我的網頁瀏覽器,我得到一個「內部服務器錯誤」信息。

我不認爲任何事情是儘可能得到一個nginx的,但我可以包括.conf文件和錯誤日誌,太,如果這是有幫助的。

我知道有一個記錄的類似的問題,但我看着他們,他們沒有我的幫助。 (這並不是說它們不包含答案。)

+0

我很懷疑這有什麼與Ubuntu版本,或與環境變量。你安裝了Django嗎?如何和在哪裏? –

+0

我確實從virutalenv的命令行安裝了Django。我的意思是在後包括(將其添加)那蟒蛇manage.py的runserver 0.0.0.0:8000「擔任了我的網站沒有問題。 –

+0

關於Ubuntu的版本中的位是,的Linode文檔稱爲新貴,其中顯然Ubuntu的16使用systemd。 (不知道我在說什麼。) –

回答

0

django docs幫我在這裏。事實證明,我對模塊的引用顯然是錯誤的。我在模塊的引用中冒過多的冒號。修正後的.ini寫着:

module = dynamicefl.wsgi:application 

什麼幫助解決了戰鬥下來了,直到我能純粹從uwsgi服務的網站,這樣我就可以停止重新啓動服務。