I am not able to launch my website. It is showing the bellow error when running it iPlanetHoster.
ModuleNotFoundError at /home/massvnrc/myproject/myproject/myapp/templates/index.html
No module named '/myapp'
Request Method: GET
Request URL: ***/home/massvnrc/myproject/myproject/myapp/templates/index.html
Django Version: 1.9.13
Exception Type: ModuleNotFoundError
Exception Value:
No module named '/myapp'
Exception Location: /home/massvnrc/virtualenv/myproject/3.7/lib64/python3.7/importlib/__init__.py in import_module, line 127
Python Executable: /home/massvnrc/virtualenv/myproject/3.7/bin/python3.7_bin
Python Version: 3.7.3
Python Path:
['/home/massvnrc/myproject',
'/opt/passenger-5.3.7-9.el7.cloudlinux/src/helper-scripts',
'/home/massvnrc/virtualenv/myproject/3.7/lib64/python37.zip',
'/home/massvnrc/virtualenv/myproject/3.7/lib64/python3.7',
'/home/massvnrc/virtualenv/myproject/3.7/lib64/python3.7/lib-dynload',
'/opt/alt/python37/lib64/python3.7',
'/opt/alt/python37/lib/python3.7',
'/home/massvnrc/virtualenv/myproject/3.7/lib/python3.7/site-packages']
Server time: Thu, 23 Jan 2020 18:03:11 +0000
Here are some pictures that are showing where my files are located.
enter image description here
Can somebody tell me why I am getting this erro
You deployed the website with debug mode turned on - never do this, at least without restricting access.
Anyway, because of this I was able to see your urls.py:
from django.contrib import admin
from django.conf.urls import url, include
# from .import views
from django.contrib.auth import views as auth_views
urlpatterns = [
url('admin/', admin.site.urls),
url('', include('/myapp.urls')), ...
]
And installed apps from settings:
INSTALLED_APPS
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles']
I do not see myapp registered in settings. You need to add it.
Next is that include('/myapp.urls') should be changes to include('myapp.urls')
Related
Hello I am beginner learning Django I am triying to follow this tutorial:
https://docs.djangoproject.com/en/1.11/intro/tutorial01/
I created an app called Polls to test my site:
Since I dont have idea where to put the file called urls.py
I put this file at the following directories:
Django/mysite/polls/urls.py
Django/mysite/polls/migrations/urls.py
This file contains:
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
]
And finally I added the following lines:
at this level:
Django/mysite/mysite/urls.py
this file contains:
from django.conf.urls import include, url
from django.contrib import admin
from django.conf.urls import url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^polls/', include('polls.urls')),
]
I dont know where is the issue but when I run:
Django/mysite$ python3 manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
April 21, 2017 - 15:59:43
Django version 1.10.5, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
I got in the page the following:
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
^admin/
^polls/
The current URL, , didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
So I really appreciate support to overcome this issue,
thanks for the support
the urls.py doesn't go into the migrations folder.
Did you register your Polls app in the settings.py file? you need to add the name of the Polls app to the INSTALLED_APPS list.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'example: add app name here',
'polls',]
you then need to create a url.py file within your polls app.
polls/
urls.py
In that file you would add:
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
]
the url you want to use in your browser would be something like this:
http://127.0.0.1:8000/polls
I am going through tutorials on django-bootstrap by this link : "https://pypi.python.org/pypi/django-bootstrap3https://pypi.python.org/pypi/django-bootstrap3"
in my settings.py:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'myapp',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
'example_app',
'southtut',
'south',
'bootstrap3',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
in my templates:
i have written
{% load bootstrap3 %}
but i am getting the follwoing on the above mentioned line in templates like:
TemplateSyntaxError at /myapp/product/
'bootstrap3' is not a valid tag library: ImportError raised loading bootstrap3.templatetags.bootstrap3: cannot import name force_text
Request Method: GET
Request URL: http://127.0.0.1:8000/myapp/product/
Django Version: 1.4.1
Exception Type: TemplateSyntaxError
Exception Value:
'bootstrap3' is not a valid tag library: ImportError raised loading bootstrap3.templatetags.bootstrap3: cannot import name force_text
Exception Location: C:\Python27\lib\site-packages\django\template\defaulttags.py in load, line 1043
Python Executable: C:\Python27\python.exe
Python Version: 2.7.1
Python Path:
['C:\\Users\\Gopi\\workspace\\myfirst',
'C:\\Python27\\lib\\site-packages\\geraldo-0.4.16-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\configparser-3.2.0r3-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\unittest2-0.5.1-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\ordereddict-1.1-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\passlib-1.6.1-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\south-0.8.3-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\openpyxl-1.7.0-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\xlutils-1.7.0-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\tesseracttrainer-0.1.1-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\goslate-1.1.2-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\futures-2.1.6-py2.7.egg',
'C:\\Windows\\system32\\python27.zip',
'C:\\Python27\\DLLs',
'C:\\Python27\\lib',
'C:\\Python27\\lib\\plat-win',
'C:\\Python27\\lib\\lib-tk',
'C:\\Python27',
'C:\\Python27\\lib\\site-packages',
'C:\\Python27\\lib\\site-packages\\PIL',
'C:\\Python27\\lib\\site-packages\\win32',
'C:\\Python27\\lib\\site-packages\\win32\\lib',
'C:\\Python27\\lib\\site-packages\\Pythonwin',
'C:\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode']
Server time: Mon, 3 Mar 2014 16:18:18 +0530
I don't know where i was wrong. help me please
The error here is "cannot import name force_text" and this is because you use Django 1.4
I am new at Django. I am trying to create basic admin panel. when I changed the urls.py file and I put url(r'^admin/', include(admin.site.urls)), into patterns then it gave error like that:
Request Method: GET return
Request URL: http://127.0.0.1:8000/
Django Version: 1.4
Exception Type: ImportError
Exception Value:cannot import name admin
Exception Location:/home/ulascan/Desktop/projects/purple/purple/urls.py in <module>, line 1
Python Executable: /usr/bin/python
Python Version: 2.7.3
Python Path:
['/home/ulascan/Desktop/projects/purple',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2'
...
...]
Make sure that in your settings.py you have django.contrib.admin, uncommented in INSTALLED_APPS. And also check that you have these lines in your urls.py:
from django.contrib import admin
admin.autodiscover()
I'm getting the following error message:
ImportError at /youtube_submit
No module named util.process
Request Method: GET
Request URL: http://myapp.com:8000/youtube_submit?videoid=vSlF8EFo8QA
Django Version: 1.4.1
Exception Type: ImportError
Exception Value:
No module named util.process
Exception Location: /Users/filipeximenes/Projects/trainee/trainee/views/youtube_submit.py in <module>, line 6
Python Executable: /Users/filipeximenes/Projects/trainee/venv/bin/python
Python Version: 2.7.3
Python Path:
['/Users/filipeximenes/Projects/trainee',
'/Users/filipeximenes/Projects/trainee/venv/lib/python2.7/site-packages/distribute-0.6.27-py2.7.egg',
'/Users/filipeximenes/Projects/trainee/venv/lib/python2.7/site-packages/pip-1.1-py2.7.egg',
'/Users/filipeximenes/Projects/trainee/venv/lib/python27.zip',
'/Users/filipeximenes/Projects/trainee/venv/lib/python2.7',
'/Users/filipeximenes/Projects/trainee/venv/lib/python2.7/plat-darwin',
'/Users/filipeximenes/Projects/trainee/venv/lib/python2.7/plat-mac',
'/Users/filipeximenes/Projects/trainee/venv/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/filipeximenes/Projects/trainee/venv/lib/python2.7/lib-tk',
'/Users/filipeximenes/Projects/trainee/venv/lib/python2.7/lib-old',
'/Users/filipeximenes/Projects/trainee/venv/lib/python2.7/lib-dynload',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/filipeximenes/Projects/trainee/venv/lib/python2.7/site-packages']
This is my requirements file:
Django==1.4.1
South==0.7.6
amqplib==1.0.2
anyjson==0.3.3
billiard==2.7.3.12
celery==3.0.9
distribute==0.6.27
dj-database-url==0.2.1
django-celery==3.0.9
facebook-sdk==0.3.2
gdata==2.0.17
gunicorn==0.14.6
kombu==2.4.5
psycopg2==2.4.5
python-dateutil==1.5
python-openid==2.2.5
wsgiref==0.1.2
I'm running the app locally, and I do have __init__.py files in all my modules.
And the app is installed:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs',
'main',
'trainee',
'company',
'videos',
'south',
)
I have other apps working perfectly, the only one that is giving me pain is the videosone.
Any ideas on whats the problem?
EDIT:
youtube submit imports:
from videos.util.process import verify_video
process.py imports:
from videos.util.youtube import YoutubeUtil
youtube.py imports:
import gdata.youtube.service
import urlparse
from videos.util.verifier import Verifier
verifier.py doesn't import anything
EDIT:
I created another app and copied all files to it.
I magically started working.
In /youtube_submit view of videos application you have imported something like this,
from util.process import *
And since ther's no such module or the folder process has no __init__.py file, you get this error
I created another app and copied all files to it. Somehow it's working now.
I want to enter to administration application of my site.
on request: http://mysite.ru/admin/ - i get an error:
ImportError at /admin/
No module named admin.site.urls
Request Method: GET
Request URL: http://mysite.ru/admin/
Django Version: 1.2.1
Exception Type: ImportError
Exception Value:
No module named admin.site.urls
Exception Location: /usr/lib/python2.4/site-packages/django/utils/importlib.py in import_module, line 35
Python Executable: /usr/bin/python
Python Version: 2.4.3
Python Path: ['/home/z/sites', '/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg', '/usr/lib/python2.4/site-packages/MySQL_python-1.2.3-py2.4-linux-i686.egg', '/usr/lib/python24.zip', '/usr/lib/python2.4', '/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk', '/usr/lib/python2.4/lib-dynload', '/usr/lib/python2.4/site-packages', '/usr/lib/python2.4/site-packages/Numeric', '/opt/CollabNet_Subversion/lib/svn-python', '/usr/lib/python2.4/site-packages/gtk-2.0']
Server time: Fri, 2 Jul 2010 02:19:12 -0500
Admin module i connected as it described here:
http://docs.djangoproject.com/en/1.2/intro/tutorial02/
What the problem?
You probably forgot to uncomment one of the lines in the settings.py:
For example:
Add "django.contrib.admin" to your
INSTALLED_APPS setting. Run python
manage.py syncdb. Since you have added
a new application to INSTALLED_APPS,
the database tables need to be
updated.
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin', #<---- !!!!! Uncomment
'mysite.polls'
)
And in your urls.py: (Although it looks like you've done this step already)
# Uncomment the next two lines to enable the admin:
from django.contrib import admin #<---- !!!!! Uncomment
admin.autodiscover() #<---- !!!!! Uncomment
urlpatterns = patterns('',
# Example:
# (r'^mysite/', include('mysite.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)), #<---- !!!!! Uncomment
)