J'essaie de déployer mon projet django existant via buildout, en suivant à la lettre les instructions here.Problème de déploiement Django et Buildout
mon fichier est buildout.cfg:
[buildout]
parts = django python
develop = .
eggs = myproject
[django]
recipe = djangorecipe
version = 1.2.3
project = myproject
projectegg = myproject
settings = settings
wsgi = true
eggs = ${buildout:eggs}
[python]
recipe = zc.recipe.egg
interpreter = python
eggs = ${buildout:eggs}
Il y a deux problèmes:
- Tout d'abord, si je l'invoque interpréteur Python via ./bin/python, je reçois une importation erreur avec myproject d'importation
- Ensuite, si je tente de charger le fichier django.wsgi, je reçois aussi une erreur apache
[Sun Oct 03 11:57:37 2010] [error] [client ::1] mod_wsgi (pid=5045): Target WSGI script '/usr/src/django/myproject/bin/django.wsgi' cannot be loaded as Python module. [Sun Oct 03 11:57:37 2010] [error] [client ::1] mod_wsgi (pid=5045): SystemExit exception raised by WSGI script '/usr/src/django/myproject/bin/django.wsgi' ignored. [Sun Oct 03 11:57:37 2010] [error] [client ::1] Traceback (most recent call last): [Sun Oct 03 11:57:37 2010] [error] [client ::1] File "/usr/src/django/myproject/bin/django.wsgi", line 20, in [Sun Oct 03 11:57:37 2010] [error] [client ::1] application = djangorecipe.wsgi.main('myproject.settings', logfile='') [Sun Oct 03 11:57:37 2010] [error] [client ::1] File "/usr/src/django/myproject/eggs/djangorecipe-0.20-py2.6.egg/djangorecipe/wsgi.py", line 15, in main [Sun Oct 03 11:57:37 2010] [error] [client ::1] sys.exit(1)
Mon fichier django.wsgi est (mis à jour selon les modifications proposées):
#!/usr/bin/python import sys sys.path[0:0] = [ '/usr/src/django/myproject/src', '/usr/src/django/myproject/eggs/djangorecipe-0.20-py2.6.egg', '/usr/src/django/myproject/eggs/zc.recipe.egg-1.3.2-py2.6.egg', '/usr/src/django/myproject/eggs/zc.buildout-1.5.1-py2.6.egg', '/usr/local/lib/python2.6/dist-packages', '/usr/local/lib/python2.6/dist-packages', '/usr/src/django/myproject/parts/django', '/usr/src/django/myproject/eggs/setuptools-0.6c12dev_r85190-py2.6.egg', '/usr/src/django/myproject/parts/django', '/usr/src/django/myproject', '/usr/src/django/myproject/src(/usr/src/django/myproject)', '/usr/src/django/myproject', ] import djangorecipe.wsgi application = djangorecipe.wsgi.main('myproject.settings', logfile='')
mon bin/django est:
#!/usr/bin/python import sys sys.path[0:0] = [ '/usr/src/django/myproject/src', '/usr/src/django/myproject/eggs/djangorecipe-0.20-py2.6.egg', '/usr/src/django/myproject/eggs/zc.recipe.egg-1.3.2-py2.6.egg', '/usr/src/django/myproject/eggs/zc.buildout-1.5.1-py2.6.egg', '/usr/local/lib/python2.6/dist-packages', '/usr/local/lib/python2.6/dist-packages', '/usr/src/django/myproject/parts/django', '/usr/src/django/myproject/eggs/setuptools-0.6c12dev_r85190-py2.6.egg', '/usr/src/django/myproject/parts/django', '/usr/src/django/myproject', '/usr/src/django/myproject/src(/usr/src/django/myproject)', '/usr/src/django/myproject', ] import djangorecipe.manage if __name__ == '__main__': djangorecipe.manage.main('myproject.settings')
Ni l'importation ou le serveur apache semblent travailler
aussi, peut-être quelqu'un avec un score plus élevé pourrait faire une étiquette djangorecipe – Dave
Il existe déjà une balise 'recipe' - il suffit d'ajouter aussi bien que' django' - pas besoin de 'djangorecipe'. –
djangorecipe.wsgi.main() est un script de ligne de commande qui ne doit pas être utilisé dans un fichier de script WSGI. –