DEV Community

Cover image for Creating The Sign Up Page Part I

Creating The Sign Up Page Part I

Hana Belay on August 25, 2021

Hello, glad to see you here again. In today's part of the series, we are going to create the sign up page. Okay to create users we need a model...
Collapse
 
jbhrfx9280 profile image
jbhrfx9280

Creating The Sign Up Page Part I
Views.py
from .forms import RegisterForm

Giving me an import error. Tried all I know and cannot get past this. Please advise. Fyi: using django 4.1
Thank you
John

Collapse
 
earthcomfy profile image
Hana Belay

Hello there, have you created a forms.py file inside the users app and then the class RegisterForm?

Collapse
 
jbhrfx9280 profile image
jbhrfx9280

Yes created forms.py inside users app and RegisterForm. I have copied all your code. I have done a couple of django / app projects myself, no issues. Normally they are path related. Everything else works in your 10 part series so far but this. Some screenshots:
Image description
Image description

Thread Thread
 
earthcomfy profile image
Hana Belay

You have created forms.py inside users/templates/users directory. It should be in users/ that means where views.py, models.py and other files are located, so move it to the correct directory and let me know.

Thread Thread
 
jbhrfx9280 profile image
jbhrfx9280

I figured it out. My mistake, I had forms.py in the template/users folder. I know better than that. There was another minor error with finding home that I fixed. I'm in chapter 6 now "Django social apps auth". After installing social-auth-app-django (verified pip list) and updating settings.py, migrate etc, I'm now getting an error after code edit in user_management/urls.py. Error: "ImportError: cannot import name 'url' from django.conf.urls (c:..... Seems to not like "from django.conf.urls import url" in projects urls.py file. So need to figure out why. Any suggestions would be helpful. Thank you. John

Thread Thread
 
jbhrfx9280 profile image
jbhrfx9280

Ok so the issue is url has been removed from django 4. It's replaced by re_path. That's the fix.

Thread Thread
 
jbhrfx9280 profile image
jbhrfx9280

Things have also changed with Google. Before u can use oauth you must use a verified fqdn and must have url to terms of service and public policy url etc. Then several stages of verifications. So cannot just hit Google and get creds to do oauth. Maybe jeed to update yor thread with the things that have changed. My 2 cents. Still love your tutorial.

Thread Thread
 
earthcomfy profile image
Hana Belay

Yes, url has been removed in Django 4. I'll update the project and the articles soon.

Thread Thread
 
earthcomfy profile image
Hana Belay

In general, thanks for your feedback and I'm glad I could help :)

Collapse
 
loger231 profile image
rus • Edited

Hi, i have this
Help please

ImportError: cannot import name 'home' from 'users.views' (D:\reglog\user_management\users\views.py)

Image description

Collapse
 
aatmaj profile image
Aatmaj

Awesome post!

Collapse
 
earthcomfy profile image
Hana Belay

Thanks, am glad you enjoyed it

Collapse
 
ssadeghh profile image
ssadeghh

Hi
why we need to use initial in our code?