Error with two same views in different apps in django project
<p>Working on django project. There are two apps in my project one is custom defined "admin", and another is "home". I am using some views same in both app for eg:- My admin app urls.py file is</p>

<pre><code>from django.conf.urls import url
from . import views

urlpatterns = [
    url(r'^$', views.index, name='index'),
    url(r'^logout$', views.logout, name='logout'),
    url(r'^dashboard$', views.dashboard, name='dashboard'),
    url(r'^profile$', views.profile, name='profile'),
    url(r'^edit-profile$', views.edit_profile, name='edit-profile'),
    url(r'^check-password$', views.check_password, name='check-password'),
    url(r'^testing$', views.testing_database, name='testing'),
]
</code></pre>

<p>and my home's app urls.py file is:-</p>

<pre><code>from django.conf.urls import url
from . import views

urlpatterns = [
    url(r'^$', views.index, name='index'),
    url(r'^sport$', views.sport, name='sport'),
    url(r'^register$', views.signup_signin, name='register'),
    url(r'^logout$', views.logout_view, name='logout'),
    url(r'^dashboard$', views.dashboard, name='dashboard'),
    url(r'^create-new-event$', views.create_new_event, name='create-new-event')
]
</code></pre>

<p>So you can check that some views are same in both of views.py file, That why whenever I am trying to login into the admin panel it's redirectingme to the home app's dashboard, and when I try to logout from admin panel it's redirecting me on home's app index page. I think that this is the problem of same views in both apps. I also tried to import views of particular app in respective urls.py file. for example:-</p>

<pre><code>from home import views
</code></pre>

<p>in home's urls.py file and for admin </p>

<pre><code>from admin import views
</code></pre>

<p>but its giving me error:-</p>

<pre><code>from admin import views
ImportError: cannot import name views
</code></pre>

<p>my root urls.py file is :-</p>

<pre><code>from django.conf.urls import include, url
from django.contrib import admin

urlpatterns = [
    url(r'^admin/', include('admin.urls')),
    url(r'^home/', include('home.urls')),
]
</code></pre>

<p>I also checked this solution on stackoverflow but did not get solution</p>

<pre><code>http://stackoverflow.com/questions/26083515/same-functions-in-different-views-django
</code></pre>

<p>The <code>admin</code> in your root urls.py specifies the django admin module, and not your custom application. You have not included your admin app's urls in the root url at all. </p>

python django