python - ImportError on Heroku django-registration-redux -
i have no problem apps when it's running locally. it's happen on heroku. deployed app heroku when open (my debug
still true
) give me importerror no module named forms
comes from registration.forms import registrationformuniqueemail
. have confusing bout because when start heroku run python manage.py shell
, doing import from registration.forms import registrationformuniqueemail
it's nothing error.
urls.py
from myapp.forms import customregistrationform registration.backends.default.views import registrationview urlpatterns = [ url(r'^register/$', logout_required(registrationview.as_view(form_class=customregistrationform)), name='registration_register'), url(r'^', include('registration.backends.default.urls')), ]
myapp/forms.py
from registration.forms import registrationformuniqueemail .validators import forbiddenusernamesvalidator class customregistrationform(registrationformuniqueemail): def __init__(self, *args, **kwargs): super(customregistrationform, self).__init__(*args, **kwargs) self.fields['username'].validators.append(forbiddenusernamesvalidator)
myapp/validators.py
from django.contrib.auth.models import user django.core.exceptions import validationerror def forbiddenusernamesvalidator(value): forbidden_usernames = ['admin', 'settings', 'news', 'about', 'help', '........'] if value.lower() in forbidden_usernames: raise validationerror('this username forbidden.') if len(value) < 4: raise validationerror('username must have @ least 4 characters.')
here's app here.
thanks.
did follow guide here http://django-registration-redux.readthedocs.io/en/latest/quickstart.html install django-registration-redux? part:
installed_apps = ( 'django.contrib.sites', 'registration', #should above 'django.contrib.auth' 'django.contrib.auth', # ...other installed applications... )