的login.html:
#include <iostream>
using namespace std;
int main()
{
int n,x,y,s=0,p=1 ;
int nr=0,nr1=0 ;
cout<<"n=" ;
cin>> n ;
cout<<"x=" ;
cin>> x ;
cout<<"y=" ;
cin>> y ;
while(n!=0)
{
if(n%10%x==0)
{
s=s+n%10 ;
nr++ ;
}
if(n%10<y)
{
p=p*(n%10) ;
nr1++ ;
}
n=n/10;
}
cout<<"s="<<s<<"\n" ;
cout<<"nr="<<nr<<"\n" ;
cout<<"p="<<p<<"\n" ;
cout<<"nr1="<<nr1<<"\n" ;
}
在settings.py中,我将其添加到已安装的应用中并指定了crispy模板包:
<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>
这在本地运行时运行良好,但是当我尝试在与服务器的ssh连接中运行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'
时,我收到以下错误:
python3.6 manage.py migrate
答案 0 :(得分:0)
通过命令在本地计算机中创建requirements.txt
:
pip3 freeze > requirements.txt
将其复制到服务器上并通过命令在服务器上安装软件包:
pip3 install -r requirements.txt