Saturday, March 2, 2019

Re: ValueError: attempted relative import beyond top-level package

I guess you miss the __init__.py file in project1 directory


Sent from my iPhone

On Mar 2, 2019, at 3:25 PM, Bulgarian seller <ppeib333@gmail.com> wrote:

from ..appTwo import views
urlpatterns
= [
    path
('',views.index),
    path
('admin/', admin.site.urls),
]

 
ValueError: attempted relative import beyond top-level package
How to fix it in django?
I have this in AppTwo.views  
def index(request):
   
return HttpResponse("<em>My Second Project</em>")

<Capture.PNG>


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/66c7e5ce-fafc-45d7-aa75-3a0ffb499ed5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<Capture.PNG>

No comments:

Post a Comment