2017-09-09 2 views
0

login.html:formes croustillantes travaux dans le site local, mais pas dans le site de production

<div class = "container"> 
    <h2 class = "text-center">Login</h2> 

    <form method = 'post'> 
     {% csrf_token %} 
     {{ form|crispy }} <!--'form' comes from login view imported in urls--> 
     <div class = "text-center"> 
      <br/> 
      <button class="btn btn-primary" type = 'submit'>Login</button> 
     </div> 

    </form> 

</div> 

En settings.py je l'ai ajouté aux applications installées et le pack spécifié modèle croustillant:

INSTALLED_APPS = [ 
    'django.contrib.admin', 
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
    'crispy_forms', 
] 

CRISPY_TEMPLATE_PACK = 'bootstrap3' 

et cela fonctionne bien quand couru localement, mais lorsque je tente de lancer python3.6 manage.py migrate dans une connexion ssh à mon serveur, je reçois l'erreur suivante:

Traceback (most recent call last): 
    File "manage.py", line 22, in <module> 
    execute_from_command_line(sys.argv) 
    File "/home/obrien98/webapps/core/lib/python3.6/Django-1.11.5-py3.6.egg/django/core/management/__init__.py", line 364, in execute_from_command_line 
    utility.execute() 
    File "/home/obrien98/webapps/core/lib/python3.6/Django-1.11.5-py3.6.egg/django/core/management/__init__.py", line 338, in execute 
    django.setup() 
    File "/home/obrien98/webapps/core/lib/python3.6/Django-1.11.5-py3.6.egg/django/__init__.py", line 27, in setup 
    apps.populate(settings.INSTALLED_APPS) 
    File "/home/obrien98/webapps/core/lib/python3.6/Django-1.11.5-py3.6.egg/django/apps/registry.py", line 85, in populate 
    app_config = AppConfig.create(entry) 
    File "/home/obrien98/webapps/core/lib/python3.6/Django-1.11.5-py3.6.egg/django/apps/config.py", line 94, in create 
    module = import_module(entry) 
    File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module 
    return _bootstrap._gcd_import(name[level:], package, level) 
    File "<frozen importlib._bootstrap>", line 978, in _gcd_import 
    File "<frozen importlib._bootstrap>", line 961, in _find_and_load 
    File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked 
ModuleNotFoundError: No module named 'crispy_forms' 

Toute aide serait appréciée

+0

avez-vous installez 'crispy_forms' sur votre serveur? montre 'pip3 freeze' sur le serveur, s'il vous plait. –

+0

cette commande retournée: 'psycopg2 == 2.5.4', est-ce que cela signifie que je dois faire pip installer django-crispy-forms dans ce même répertoire? –

Répondre

0

créer requirements.txt dans votre machine locale, par commande:

pip3 freeze > requirements.txt 

copie sur serveur et installer des paquets sur votre serveur, par commande:

pip3 install -r requirements.txt