Когда я замираю на консоли heroku, я обнаружил, что django установлен. Когда я пытаюсь отправить форму локально на моем компьютере, отправка проходит успешно, без ошибок.
Views.py
'''
@login_required(login_url='/accounts/login/')
def b_contact(request):
c_form = ContactForm
if request.method == 'POST':
c_form = ContactForm(data=request.POST)
if c_form.is_valid():
email = c_form.cleaned_data['email']
subject = c_form.cleaned_data['subject']
message = c_form.cleaned_data['message']
send_mail(email, message, subject, ['be.rightmuk@gmail.com'], fail_silently=False)
messages.success(request, f'Your message has been sent!')
return redirect('buyer_home')
else:
email = request.POST.get('email')
subject = request.POST.get('subject')
message = request.POST.get('message')
context = {
'c_form': c_form
}
return render(request, 'buyer/contact.html', context)
'' '
forms.py
class ContactForm(forms.Form):
email = forms.EmailField(label='Your Email')
subject = forms.CharField(required=True, max_length=150)
message = forms.CharField(widget=forms.Textarea, required=True)
tepmplate
<form method="POST">
{% csrf_token %}
<fieldset class="form-group">
{{ c_form|crispy }}
</fieldset>
<button class="btn btn-default" type="submit">Send </button>
</form>
needs.txt
dj-database-url==0.5.0
Django==2.0
django-bootstrap3==11.0.0
django-bootstrap4==1.0.1
django-braces==1.13.0
django-crispy-forms==1.7.2
django-heroku==0.3.1
django-model-utils==3.2.0
django-progressive-web-app==0.1.1
django-registration==2.4.1
django-tinymce==2.8.0
djangorestframework==3.9.4
gunicorn==19.9.0
Это ошибка
ModuleNotFoundError at /seller/contact/
No module named "'django"
Request Method: POST
Request URL:
https://sakka.herokuapp.com/seller/contact/
Django Version: 2.0
Exception Type: ModuleNotFoundError
Exception Value:
No module named "'django"
Exception Location: <frozen importlib._bootstrap> in
_find_and_load_unlocked, line 953
Python Executable: /app/.heroku/python/bin/python
Python Version: 3.6.8
Python Path:
['/app/.heroku/python/bin',
' /app',
'/app/.heroku/python/lib/python36.zip',
'/app/.heroku/python/lib/python3.6',
'/app/.heroku/python/lib/python3.6/lib-dynload',
'/app/.heroku/python/lib/python3.6/site-packages']
Server time: Thu, 24 Oct 2019 15:06:42 +0300
Эта ошибка возникает только тогда, когда я пытаюсь опубликовать некоторую информацию из моей контактной формы, в противном случае все остальное работает нормально