Django ModuleNotFoundError: No module named 'ui'
I am trying to start up a very basic web app with Django and getting ModuleNotFoundError: No module named 'ui'
My django project is frontend_project
and the app is ui
Tree:
front_end
├── front-end/Pipfile
├── front-end/Pipfile.lock
├── front-end/README.md
├── front-end/db.sqlite3
├── front-end/frontend_project
│ ├── front-end/frontend_project/__init__.py
│ ├── front-end/frontend_project/
│ │ └──front-end/frontend_project/ui
│ │ ├── front-end/frontend_project/ui/__init__.py
│ │ ├── front-end/frontend_project/ui/admin.py
│ │ ├── front-end/frontend_project/ui/apps.py
│ │ ├── front-end/frontend_project/ui/migrations
│ │ │ └── front-end/frontend_project/ui/migrations/__init__.py
│ │ ├── front-end/frontend_project/ui/models.py
│ │ ├── front-end/frontend_project/ui/tests.py
│ │ ├── front-end/frontend_project/ui/urls.py
│ │ └── front-end/frontend_project/ui/views.py
│ ├── front-end/frontend_project/settings.py
│ ├── front-end/frontend_project/urls.py
│ └── front-end/frontend_project/wsgi.py
└── front-end/manage.py
Installed_apps:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'ui.apps.UiConfig',
]
And my frontend_project
urls.py looks like:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('ui.urls')),
]
ui
urls.py
from django.urls import path
from .views import homePageView
urlpatterns = [
path('', homePageView, name='home'),
]
EDIT: I removed the apps directory and placed the UI app under the project directory - Still experiencing the same error ModuleNotFoundError: No module named 'ui'
I'm just trying to get a simple web app working for right now and my python version is 3.6.7 and pipenv.
Thanks all!
python django python-3.x
|
show 1 more comment
I am trying to start up a very basic web app with Django and getting ModuleNotFoundError: No module named 'ui'
My django project is frontend_project
and the app is ui
Tree:
front_end
├── front-end/Pipfile
├── front-end/Pipfile.lock
├── front-end/README.md
├── front-end/db.sqlite3
├── front-end/frontend_project
│ ├── front-end/frontend_project/__init__.py
│ ├── front-end/frontend_project/
│ │ └──front-end/frontend_project/ui
│ │ ├── front-end/frontend_project/ui/__init__.py
│ │ ├── front-end/frontend_project/ui/admin.py
│ │ ├── front-end/frontend_project/ui/apps.py
│ │ ├── front-end/frontend_project/ui/migrations
│ │ │ └── front-end/frontend_project/ui/migrations/__init__.py
│ │ ├── front-end/frontend_project/ui/models.py
│ │ ├── front-end/frontend_project/ui/tests.py
│ │ ├── front-end/frontend_project/ui/urls.py
│ │ └── front-end/frontend_project/ui/views.py
│ ├── front-end/frontend_project/settings.py
│ ├── front-end/frontend_project/urls.py
│ └── front-end/frontend_project/wsgi.py
└── front-end/manage.py
Installed_apps:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'ui.apps.UiConfig',
]
And my frontend_project
urls.py looks like:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('ui.urls')),
]
ui
urls.py
from django.urls import path
from .views import homePageView
urlpatterns = [
path('', homePageView, name='home'),
]
EDIT: I removed the apps directory and placed the UI app under the project directory - Still experiencing the same error ModuleNotFoundError: No module named 'ui'
I'm just trying to get a simple web app working for right now and my python version is 3.6.7 and pipenv.
Thanks all!
python django python-3.x
What is the value ofsys.path
?
– John Gordon
Nov 16 '18 at 22:32
it returns empty, so i guess that it isn't set... should this env variable be set automatically by python?
– aphexlog
Nov 16 '18 at 22:34
@JohnGordon also, I am using pipenv
– aphexlog
Nov 16 '18 at 22:38
You probably need to pre-pend "apps" in your INSTALLED_APPS settings. You have everything underneath a directory called "apps" (which isn't standard AFAIK) but that's probably what's going on here. If you brought all those files up a level and deleted "apps" it would probably work just fine.
– theWanderer4865
Nov 16 '18 at 22:47
@theWanderer4865 I previously had it directory above apps with the same issue
– aphexlog
Nov 16 '18 at 22:48
|
show 1 more comment
I am trying to start up a very basic web app with Django and getting ModuleNotFoundError: No module named 'ui'
My django project is frontend_project
and the app is ui
Tree:
front_end
├── front-end/Pipfile
├── front-end/Pipfile.lock
├── front-end/README.md
├── front-end/db.sqlite3
├── front-end/frontend_project
│ ├── front-end/frontend_project/__init__.py
│ ├── front-end/frontend_project/
│ │ └──front-end/frontend_project/ui
│ │ ├── front-end/frontend_project/ui/__init__.py
│ │ ├── front-end/frontend_project/ui/admin.py
│ │ ├── front-end/frontend_project/ui/apps.py
│ │ ├── front-end/frontend_project/ui/migrations
│ │ │ └── front-end/frontend_project/ui/migrations/__init__.py
│ │ ├── front-end/frontend_project/ui/models.py
│ │ ├── front-end/frontend_project/ui/tests.py
│ │ ├── front-end/frontend_project/ui/urls.py
│ │ └── front-end/frontend_project/ui/views.py
│ ├── front-end/frontend_project/settings.py
│ ├── front-end/frontend_project/urls.py
│ └── front-end/frontend_project/wsgi.py
└── front-end/manage.py
Installed_apps:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'ui.apps.UiConfig',
]
And my frontend_project
urls.py looks like:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('ui.urls')),
]
ui
urls.py
from django.urls import path
from .views import homePageView
urlpatterns = [
path('', homePageView, name='home'),
]
EDIT: I removed the apps directory and placed the UI app under the project directory - Still experiencing the same error ModuleNotFoundError: No module named 'ui'
I'm just trying to get a simple web app working for right now and my python version is 3.6.7 and pipenv.
Thanks all!
python django python-3.x
I am trying to start up a very basic web app with Django and getting ModuleNotFoundError: No module named 'ui'
My django project is frontend_project
and the app is ui
Tree:
front_end
├── front-end/Pipfile
├── front-end/Pipfile.lock
├── front-end/README.md
├── front-end/db.sqlite3
├── front-end/frontend_project
│ ├── front-end/frontend_project/__init__.py
│ ├── front-end/frontend_project/
│ │ └──front-end/frontend_project/ui
│ │ ├── front-end/frontend_project/ui/__init__.py
│ │ ├── front-end/frontend_project/ui/admin.py
│ │ ├── front-end/frontend_project/ui/apps.py
│ │ ├── front-end/frontend_project/ui/migrations
│ │ │ └── front-end/frontend_project/ui/migrations/__init__.py
│ │ ├── front-end/frontend_project/ui/models.py
│ │ ├── front-end/frontend_project/ui/tests.py
│ │ ├── front-end/frontend_project/ui/urls.py
│ │ └── front-end/frontend_project/ui/views.py
│ ├── front-end/frontend_project/settings.py
│ ├── front-end/frontend_project/urls.py
│ └── front-end/frontend_project/wsgi.py
└── front-end/manage.py
Installed_apps:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'ui.apps.UiConfig',
]
And my frontend_project
urls.py looks like:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('ui.urls')),
]
ui
urls.py
from django.urls import path
from .views import homePageView
urlpatterns = [
path('', homePageView, name='home'),
]
EDIT: I removed the apps directory and placed the UI app under the project directory - Still experiencing the same error ModuleNotFoundError: No module named 'ui'
I'm just trying to get a simple web app working for right now and my python version is 3.6.7 and pipenv.
Thanks all!
python django python-3.x
python django python-3.x
edited Nov 19 '18 at 15:45
aphexlog
asked Nov 16 '18 at 22:30
aphexlogaphexlog
57115
57115
What is the value ofsys.path
?
– John Gordon
Nov 16 '18 at 22:32
it returns empty, so i guess that it isn't set... should this env variable be set automatically by python?
– aphexlog
Nov 16 '18 at 22:34
@JohnGordon also, I am using pipenv
– aphexlog
Nov 16 '18 at 22:38
You probably need to pre-pend "apps" in your INSTALLED_APPS settings. You have everything underneath a directory called "apps" (which isn't standard AFAIK) but that's probably what's going on here. If you brought all those files up a level and deleted "apps" it would probably work just fine.
– theWanderer4865
Nov 16 '18 at 22:47
@theWanderer4865 I previously had it directory above apps with the same issue
– aphexlog
Nov 16 '18 at 22:48
|
show 1 more comment
What is the value ofsys.path
?
– John Gordon
Nov 16 '18 at 22:32
it returns empty, so i guess that it isn't set... should this env variable be set automatically by python?
– aphexlog
Nov 16 '18 at 22:34
@JohnGordon also, I am using pipenv
– aphexlog
Nov 16 '18 at 22:38
You probably need to pre-pend "apps" in your INSTALLED_APPS settings. You have everything underneath a directory called "apps" (which isn't standard AFAIK) but that's probably what's going on here. If you brought all those files up a level and deleted "apps" it would probably work just fine.
– theWanderer4865
Nov 16 '18 at 22:47
@theWanderer4865 I previously had it directory above apps with the same issue
– aphexlog
Nov 16 '18 at 22:48
What is the value of
sys.path
?– John Gordon
Nov 16 '18 at 22:32
What is the value of
sys.path
?– John Gordon
Nov 16 '18 at 22:32
it returns empty, so i guess that it isn't set... should this env variable be set automatically by python?
– aphexlog
Nov 16 '18 at 22:34
it returns empty, so i guess that it isn't set... should this env variable be set automatically by python?
– aphexlog
Nov 16 '18 at 22:34
@JohnGordon also, I am using pipenv
– aphexlog
Nov 16 '18 at 22:38
@JohnGordon also, I am using pipenv
– aphexlog
Nov 16 '18 at 22:38
You probably need to pre-pend "apps" in your INSTALLED_APPS settings. You have everything underneath a directory called "apps" (which isn't standard AFAIK) but that's probably what's going on here. If you brought all those files up a level and deleted "apps" it would probably work just fine.
– theWanderer4865
Nov 16 '18 at 22:47
You probably need to pre-pend "apps" in your INSTALLED_APPS settings. You have everything underneath a directory called "apps" (which isn't standard AFAIK) but that's probably what's going on here. If you brought all those files up a level and deleted "apps" it would probably work just fine.
– theWanderer4865
Nov 16 '18 at 22:47
@theWanderer4865 I previously had it directory above apps with the same issue
– aphexlog
Nov 16 '18 at 22:48
@theWanderer4865 I previously had it directory above apps with the same issue
– aphexlog
Nov 16 '18 at 22:48
|
show 1 more comment
4 Answers
4
active
oldest
votes
You have configured your project in an atypical way. While not absolutely required, the most straightforward (and most common) way to structure the project is to include your project apps in the root directory, which is the directory that contains manage.py.
In your case, your 'ui' app directory would be located at front_end/front_end/. (Not under /front_end/front_end/front_end/frontend_project/)
IF you want to keep the project structure that you currently have, there are a additional configuration changes necessary, including subclassing AppConfig (see below).
You will also need to use a dotted path to your application urlconf from your root UrlConf (This is the configuration step that you missed that is likely causing the error).
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('frontend_project.ui.urls')), <--- here
]
In your case, by defining a direct path to 'ui.apps.UiConfig'
in INSTALLED_APPS, Django looks for the configuration in the dotted path to the AppConfig subclass for that application which is located in apps.py.
# ui/apps.py
from django.apps import AppConfig
class UiConfig(AppConfig):
name = 'ui'
If i have done what?'ui.apps.UiConfig'
is in my settings already and my apps.pt already looks exactly like that, so what are you suggesting hat i do?
– aphexlog
Nov 19 '18 at 16:00
Also, I reverted back to the way I had the directory structure in the pastfrontend_project/ui/
and having the same error:ModuleNotFoundError: No module named 'ui'
– aphexlog
Nov 19 '18 at 16:00
move it up to dir with manage.py --> front_end/front_end so that dir would include: frontend_project/, ui/, README.md, manage.py, db.sql..., Pip..., Pipfile.lock; frontend_project/ would include settings.py, urls.py, wsgi.py, init.py; ui/ would include admin.py, apps.py, models.py, tests.py, urls.py, views.py, init.py, migrations/
– chuck_sum
Nov 19 '18 at 23:18
add a comment |
I think you need to create an __init__.py
file at front-end/frontend_project/apps/
I had the ecact same issue what my directory structure wasfront-end/frontend_project/ui
... I reverted it back to that and i'm having the same issue.
– aphexlog
Nov 19 '18 at 15:53
add a comment |
Import urls.py file of Ui app in frontend_project urls.py file.
from django.contrib import admin
from django.urls import path, include
from ui import urls
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('ui.urls')),
]
[pylint] Unable to import 'ui' [E0401]
– aphexlog
Nov 19 '18 at 15:21
@aphexlog your app must in root directory.
– Faizan Fareed
Nov 20 '18 at 3:59
My app now sits atfrontend_project/ui
with the same issue
– aphexlog
Nov 20 '18 at 15:44
add a comment |
I fixed the issue by moving ui to root as suggested, Thanks everyone!
But I thought that the directory structure was supposed to be project_name/app_name
.. apparently, the app is actually supposed to sit in the same directory as the project?
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53346264%2fdjango-modulenotfounderror-no-module-named-ui%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have configured your project in an atypical way. While not absolutely required, the most straightforward (and most common) way to structure the project is to include your project apps in the root directory, which is the directory that contains manage.py.
In your case, your 'ui' app directory would be located at front_end/front_end/. (Not under /front_end/front_end/front_end/frontend_project/)
IF you want to keep the project structure that you currently have, there are a additional configuration changes necessary, including subclassing AppConfig (see below).
You will also need to use a dotted path to your application urlconf from your root UrlConf (This is the configuration step that you missed that is likely causing the error).
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('frontend_project.ui.urls')), <--- here
]
In your case, by defining a direct path to 'ui.apps.UiConfig'
in INSTALLED_APPS, Django looks for the configuration in the dotted path to the AppConfig subclass for that application which is located in apps.py.
# ui/apps.py
from django.apps import AppConfig
class UiConfig(AppConfig):
name = 'ui'
If i have done what?'ui.apps.UiConfig'
is in my settings already and my apps.pt already looks exactly like that, so what are you suggesting hat i do?
– aphexlog
Nov 19 '18 at 16:00
Also, I reverted back to the way I had the directory structure in the pastfrontend_project/ui/
and having the same error:ModuleNotFoundError: No module named 'ui'
– aphexlog
Nov 19 '18 at 16:00
move it up to dir with manage.py --> front_end/front_end so that dir would include: frontend_project/, ui/, README.md, manage.py, db.sql..., Pip..., Pipfile.lock; frontend_project/ would include settings.py, urls.py, wsgi.py, init.py; ui/ would include admin.py, apps.py, models.py, tests.py, urls.py, views.py, init.py, migrations/
– chuck_sum
Nov 19 '18 at 23:18
add a comment |
You have configured your project in an atypical way. While not absolutely required, the most straightforward (and most common) way to structure the project is to include your project apps in the root directory, which is the directory that contains manage.py.
In your case, your 'ui' app directory would be located at front_end/front_end/. (Not under /front_end/front_end/front_end/frontend_project/)
IF you want to keep the project structure that you currently have, there are a additional configuration changes necessary, including subclassing AppConfig (see below).
You will also need to use a dotted path to your application urlconf from your root UrlConf (This is the configuration step that you missed that is likely causing the error).
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('frontend_project.ui.urls')), <--- here
]
In your case, by defining a direct path to 'ui.apps.UiConfig'
in INSTALLED_APPS, Django looks for the configuration in the dotted path to the AppConfig subclass for that application which is located in apps.py.
# ui/apps.py
from django.apps import AppConfig
class UiConfig(AppConfig):
name = 'ui'
If i have done what?'ui.apps.UiConfig'
is in my settings already and my apps.pt already looks exactly like that, so what are you suggesting hat i do?
– aphexlog
Nov 19 '18 at 16:00
Also, I reverted back to the way I had the directory structure in the pastfrontend_project/ui/
and having the same error:ModuleNotFoundError: No module named 'ui'
– aphexlog
Nov 19 '18 at 16:00
move it up to dir with manage.py --> front_end/front_end so that dir would include: frontend_project/, ui/, README.md, manage.py, db.sql..., Pip..., Pipfile.lock; frontend_project/ would include settings.py, urls.py, wsgi.py, init.py; ui/ would include admin.py, apps.py, models.py, tests.py, urls.py, views.py, init.py, migrations/
– chuck_sum
Nov 19 '18 at 23:18
add a comment |
You have configured your project in an atypical way. While not absolutely required, the most straightforward (and most common) way to structure the project is to include your project apps in the root directory, which is the directory that contains manage.py.
In your case, your 'ui' app directory would be located at front_end/front_end/. (Not under /front_end/front_end/front_end/frontend_project/)
IF you want to keep the project structure that you currently have, there are a additional configuration changes necessary, including subclassing AppConfig (see below).
You will also need to use a dotted path to your application urlconf from your root UrlConf (This is the configuration step that you missed that is likely causing the error).
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('frontend_project.ui.urls')), <--- here
]
In your case, by defining a direct path to 'ui.apps.UiConfig'
in INSTALLED_APPS, Django looks for the configuration in the dotted path to the AppConfig subclass for that application which is located in apps.py.
# ui/apps.py
from django.apps import AppConfig
class UiConfig(AppConfig):
name = 'ui'
You have configured your project in an atypical way. While not absolutely required, the most straightforward (and most common) way to structure the project is to include your project apps in the root directory, which is the directory that contains manage.py.
In your case, your 'ui' app directory would be located at front_end/front_end/. (Not under /front_end/front_end/front_end/frontend_project/)
IF you want to keep the project structure that you currently have, there are a additional configuration changes necessary, including subclassing AppConfig (see below).
You will also need to use a dotted path to your application urlconf from your root UrlConf (This is the configuration step that you missed that is likely causing the error).
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('frontend_project.ui.urls')), <--- here
]
In your case, by defining a direct path to 'ui.apps.UiConfig'
in INSTALLED_APPS, Django looks for the configuration in the dotted path to the AppConfig subclass for that application which is located in apps.py.
# ui/apps.py
from django.apps import AppConfig
class UiConfig(AppConfig):
name = 'ui'
edited Nov 21 '18 at 4:10
answered Nov 17 '18 at 20:12
chuck_sumchuck_sum
386
386
If i have done what?'ui.apps.UiConfig'
is in my settings already and my apps.pt already looks exactly like that, so what are you suggesting hat i do?
– aphexlog
Nov 19 '18 at 16:00
Also, I reverted back to the way I had the directory structure in the pastfrontend_project/ui/
and having the same error:ModuleNotFoundError: No module named 'ui'
– aphexlog
Nov 19 '18 at 16:00
move it up to dir with manage.py --> front_end/front_end so that dir would include: frontend_project/, ui/, README.md, manage.py, db.sql..., Pip..., Pipfile.lock; frontend_project/ would include settings.py, urls.py, wsgi.py, init.py; ui/ would include admin.py, apps.py, models.py, tests.py, urls.py, views.py, init.py, migrations/
– chuck_sum
Nov 19 '18 at 23:18
add a comment |
If i have done what?'ui.apps.UiConfig'
is in my settings already and my apps.pt already looks exactly like that, so what are you suggesting hat i do?
– aphexlog
Nov 19 '18 at 16:00
Also, I reverted back to the way I had the directory structure in the pastfrontend_project/ui/
and having the same error:ModuleNotFoundError: No module named 'ui'
– aphexlog
Nov 19 '18 at 16:00
move it up to dir with manage.py --> front_end/front_end so that dir would include: frontend_project/, ui/, README.md, manage.py, db.sql..., Pip..., Pipfile.lock; frontend_project/ would include settings.py, urls.py, wsgi.py, init.py; ui/ would include admin.py, apps.py, models.py, tests.py, urls.py, views.py, init.py, migrations/
– chuck_sum
Nov 19 '18 at 23:18
If i have done what?
'ui.apps.UiConfig'
is in my settings already and my apps.pt already looks exactly like that, so what are you suggesting hat i do?– aphexlog
Nov 19 '18 at 16:00
If i have done what?
'ui.apps.UiConfig'
is in my settings already and my apps.pt already looks exactly like that, so what are you suggesting hat i do?– aphexlog
Nov 19 '18 at 16:00
Also, I reverted back to the way I had the directory structure in the past
frontend_project/ui/
and having the same error: ModuleNotFoundError: No module named 'ui'
– aphexlog
Nov 19 '18 at 16:00
Also, I reverted back to the way I had the directory structure in the past
frontend_project/ui/
and having the same error: ModuleNotFoundError: No module named 'ui'
– aphexlog
Nov 19 '18 at 16:00
move it up to dir with manage.py --> front_end/front_end so that dir would include: frontend_project/, ui/, README.md, manage.py, db.sql..., Pip..., Pipfile.lock; frontend_project/ would include settings.py, urls.py, wsgi.py, init.py; ui/ would include admin.py, apps.py, models.py, tests.py, urls.py, views.py, init.py, migrations/
– chuck_sum
Nov 19 '18 at 23:18
move it up to dir with manage.py --> front_end/front_end so that dir would include: frontend_project/, ui/, README.md, manage.py, db.sql..., Pip..., Pipfile.lock; frontend_project/ would include settings.py, urls.py, wsgi.py, init.py; ui/ would include admin.py, apps.py, models.py, tests.py, urls.py, views.py, init.py, migrations/
– chuck_sum
Nov 19 '18 at 23:18
add a comment |
I think you need to create an __init__.py
file at front-end/frontend_project/apps/
I had the ecact same issue what my directory structure wasfront-end/frontend_project/ui
... I reverted it back to that and i'm having the same issue.
– aphexlog
Nov 19 '18 at 15:53
add a comment |
I think you need to create an __init__.py
file at front-end/frontend_project/apps/
I had the ecact same issue what my directory structure wasfront-end/frontend_project/ui
... I reverted it back to that and i'm having the same issue.
– aphexlog
Nov 19 '18 at 15:53
add a comment |
I think you need to create an __init__.py
file at front-end/frontend_project/apps/
I think you need to create an __init__.py
file at front-end/frontend_project/apps/
answered Nov 17 '18 at 16:11
schillingtschillingt
5,42711722
5,42711722
I had the ecact same issue what my directory structure wasfront-end/frontend_project/ui
... I reverted it back to that and i'm having the same issue.
– aphexlog
Nov 19 '18 at 15:53
add a comment |
I had the ecact same issue what my directory structure wasfront-end/frontend_project/ui
... I reverted it back to that and i'm having the same issue.
– aphexlog
Nov 19 '18 at 15:53
I had the ecact same issue what my directory structure was
front-end/frontend_project/ui
... I reverted it back to that and i'm having the same issue.– aphexlog
Nov 19 '18 at 15:53
I had the ecact same issue what my directory structure was
front-end/frontend_project/ui
... I reverted it back to that and i'm having the same issue.– aphexlog
Nov 19 '18 at 15:53
add a comment |
Import urls.py file of Ui app in frontend_project urls.py file.
from django.contrib import admin
from django.urls import path, include
from ui import urls
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('ui.urls')),
]
[pylint] Unable to import 'ui' [E0401]
– aphexlog
Nov 19 '18 at 15:21
@aphexlog your app must in root directory.
– Faizan Fareed
Nov 20 '18 at 3:59
My app now sits atfrontend_project/ui
with the same issue
– aphexlog
Nov 20 '18 at 15:44
add a comment |
Import urls.py file of Ui app in frontend_project urls.py file.
from django.contrib import admin
from django.urls import path, include
from ui import urls
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('ui.urls')),
]
[pylint] Unable to import 'ui' [E0401]
– aphexlog
Nov 19 '18 at 15:21
@aphexlog your app must in root directory.
– Faizan Fareed
Nov 20 '18 at 3:59
My app now sits atfrontend_project/ui
with the same issue
– aphexlog
Nov 20 '18 at 15:44
add a comment |
Import urls.py file of Ui app in frontend_project urls.py file.
from django.contrib import admin
from django.urls import path, include
from ui import urls
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('ui.urls')),
]
Import urls.py file of Ui app in frontend_project urls.py file.
from django.contrib import admin
from django.urls import path, include
from ui import urls
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('ui.urls')),
]
answered Nov 18 '18 at 18:40
Faizan FareedFaizan Fareed
506
506
[pylint] Unable to import 'ui' [E0401]
– aphexlog
Nov 19 '18 at 15:21
@aphexlog your app must in root directory.
– Faizan Fareed
Nov 20 '18 at 3:59
My app now sits atfrontend_project/ui
with the same issue
– aphexlog
Nov 20 '18 at 15:44
add a comment |
[pylint] Unable to import 'ui' [E0401]
– aphexlog
Nov 19 '18 at 15:21
@aphexlog your app must in root directory.
– Faizan Fareed
Nov 20 '18 at 3:59
My app now sits atfrontend_project/ui
with the same issue
– aphexlog
Nov 20 '18 at 15:44
[pylint] Unable to import 'ui' [E0401]
– aphexlog
Nov 19 '18 at 15:21
[pylint] Unable to import 'ui' [E0401]
– aphexlog
Nov 19 '18 at 15:21
@aphexlog your app must in root directory.
– Faizan Fareed
Nov 20 '18 at 3:59
@aphexlog your app must in root directory.
– Faizan Fareed
Nov 20 '18 at 3:59
My app now sits at
frontend_project/ui
with the same issue– aphexlog
Nov 20 '18 at 15:44
My app now sits at
frontend_project/ui
with the same issue– aphexlog
Nov 20 '18 at 15:44
add a comment |
I fixed the issue by moving ui to root as suggested, Thanks everyone!
But I thought that the directory structure was supposed to be project_name/app_name
.. apparently, the app is actually supposed to sit in the same directory as the project?
add a comment |
I fixed the issue by moving ui to root as suggested, Thanks everyone!
But I thought that the directory structure was supposed to be project_name/app_name
.. apparently, the app is actually supposed to sit in the same directory as the project?
add a comment |
I fixed the issue by moving ui to root as suggested, Thanks everyone!
But I thought that the directory structure was supposed to be project_name/app_name
.. apparently, the app is actually supposed to sit in the same directory as the project?
I fixed the issue by moving ui to root as suggested, Thanks everyone!
But I thought that the directory structure was supposed to be project_name/app_name
.. apparently, the app is actually supposed to sit in the same directory as the project?
answered Nov 20 '18 at 17:57
aphexlogaphexlog
57115
57115
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53346264%2fdjango-modulenotfounderror-no-module-named-ui%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What is the value of
sys.path
?– John Gordon
Nov 16 '18 at 22:32
it returns empty, so i guess that it isn't set... should this env variable be set automatically by python?
– aphexlog
Nov 16 '18 at 22:34
@JohnGordon also, I am using pipenv
– aphexlog
Nov 16 '18 at 22:38
You probably need to pre-pend "apps" in your INSTALLED_APPS settings. You have everything underneath a directory called "apps" (which isn't standard AFAIK) but that's probably what's going on here. If you brought all those files up a level and deleted "apps" it would probably work just fine.
– theWanderer4865
Nov 16 '18 at 22:47
@theWanderer4865 I previously had it directory above apps with the same issue
– aphexlog
Nov 16 '18 at 22:48