2010-12-30 13 views
7

PyCharm'da Django test koşucusu için farklı ayar dosyaları kullanma konusunda herhangi bir deneyiminiz var mı?PyCharm 1.1 - django test çalıştırıcısı için özel ayarları kullanma

+penguinproject 
+apps 
+settings 
--__init__.py 
--common.py # this one is imported by the others below 
--development.py 
--production.py 
--staging.py 
+static 
... 

bir manage.py komutuyla testleri Running (ve --settings = settings.development ekleme) çalışıyor, ancak inşa kullanmak istiyorum:

şöyle Projem oluşmaktadır test çalıştırıcısında (IDE ile daha iyi entegre olduğu gibi). (

E:\Development\django_projects\penguinproject\Scripts\python.exe "C:\Program Files (x86)\JetBrains\PyCharm 1.1\helpers\pydev\pydevd.py" --client 127.0.0.1 --port 49898 --file "C:\Program Files (x86)\JetBrains\PyCharm 1.1\helpers\pycharm\django_manage.py" test items 
Testing started at 20:36 ... 
pydev debugger: warning: psyco not available for speedups (the debugger will still work correctly, but a bit slower) 
pydev debugger: starting 
E:\Development\django_projects\penguinproject\lib\site-packages\path.py:32: DeprecationWarning: the md5 module is deprecated; use hashlib instead 
import sys, warnings, os, fnmatch, glob, shutil, codecs, md5 
settings file: development 
pycharm django settings imported 
Manager file: manage 
Traceback (most recent call last): 
File "C:\Program Files (x86)\JetBrains\PyCharm 1.1\helpers\pydev\pydevd.py", line 1165, in <module> 
debugger.run(setup['file'], None, None) 
File "C:\Program Files (x86)\JetBrains\PyCharm 1.1\helpers\pydev\pydevd.py", line 929, in run 
execfile(file, globals, locals) #execute the script 
File "C:\Program Files (x86)\JetBrains\PyCharm 1.1\helpers\pycharm\django_manage.py", line 15, in <module> 
run_module(manage_file, None, '__main__') 
File "c:\python26\Lib\runpy.py", line 140, in run_module 
fname, loader, pkg_name) 
File "c:\python26\Lib\runpy.py", line 34, in _run_code 
exec code in run_globals 
File "E:\Development\django_projects\penguinproject\yabe\manage.py", line 11, in <module> 
execute_manager(settings) 
File "E:\Development\django_projects\penguinproject\lib\site-packages\django\core\management\__init__.py", line 438, in execute_manager 
utility.execute() 
File "E:\Development\django_projects\penguinproject\lib\site-packages\django\core\management\__init__.py", line 379, in execute 
self.fetch_command(subcommand).run_from_argv(self.argv) 
File "E:\Development\django_projects\penguinproject\lib\site-packages\django\core\management\base.py", line 191, in run_from_argv 
self.execute(*args, **options.__dict__) 
File "E:\Development\django_projects\penguinproject\lib\site-packages\django\core\management\base.py", line 220, in execute 
output = self.handle(*args, **options) 
File "E:\Development\django_projects\penguinproject\lib\site-packages\django\core\management\commands\test.py", line 37, in handle 
failures = test_runner.run_tests(test_labels) 
File "E:\Development\django_projects\penguinproject\lib\site-packages\django\test\simple.py", line 396, in run_tests 
suite = self.build_suite(test_labels, extra_tests) 
File "E:\Development\django_projects\penguinproject\lib\site-packages\django\test\simple.py", line 285, in build_suite 
app = get_app(label) 
File "E:\Development\django_projects\penguinproject\lib\site-packages\django\db\models\loading.py", line 140, in get_app 
raise ImproperlyConfigured("App with label %s could not be found" % app_label) 
django.core.exceptions.ImproperlyConfigured: App with label items could not be found 

komut satırından manage.py kullanarak bu hatayı alamadım:

Sorunun bu hatayı olsun ayarlarım doğru yükleniyor olmamasıdır düşünüyorum Ayrıca IDE) içinden çağrıldığında da, development.py ayarlarının doğru yüklenmediğini düşünmemi sağlıyor. Hata ayıklama, get_app() (loading.py modülünde) settings.INSTALLED_APPS öğesinin boş bir liste olduğunu gösterir.

Bu ayar ayarları dosyasıyla test yürütücüsünü ayarlamayı kim başarabildi?

Şimdiden çok teşekkürler!

+0

Ben Tutulma da benzer bir problem olduğunu düşünüyorum. Bu dponde ve djanjo.setup() bir yerde çalıştırmak için django gerekir. –

cevap

0

Bu uygulamada bir models.py oluşturmalısınız!

http://code.djangoproject.com/ticket/3310

+0

İçerisinde: uygulamalar dizini, uygulama başına gerekli tüm dosyaları (tests.py, models.py, views.py, vb.) Içerir. Model.py dosyası olmasaydı, komut satırından çalıştırılan testler de işe yaramazdı. – LaundroMat

1

i proje yapısının hafif bir değişiklik öneririm. Bu çok, çok daha detaylı bir örnek göz atın:

http://www.revsys.com/blog/2014/nov/21/recommended-django-project-layout/

bir üst düzey dizin VE sonraki tüm ayarlar dosyaları gitmek aynı adla bir alt dizin var göreceksiniz. Yine bir başka başvuru için

, ilk proje yapısını oluşturmak için kullanılabilecek 'startproject' komutunu göz atın:

https://docs.djangoproject.com/en/1.10/ref/django-admin/#django-admin-startproject

hth