files add before after running server - python

When i run python manage.py runserver 8000
one file fuzzy.xml comes first and when I delete that file from that directory it sends error
/home/yelesee/Desktop/Mirab/Mirab/web/data/fuzzy.xml
System check identified no issues (0 silenced).
September 05, 2018 - 06:51:30
Django version 1.11, using settings 'Mirab.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C
and the last line of error is
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/xml/etree/ElementTree.py", line 647, in parse
source = open(source, "rb")
IOError: [Errno 2] No such file or directory: '/home/yelesee/Desktop/Mirab/Mirab/web/data/fuzzy.xml'
I don't know where to search and remove that from code.
where should I find that?
Unhandled exception in thread started by <function wrapper at 0x7f2c20bbca28>
Traceback (most recent call last):
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/site-packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
self.check(display_num_errors=True)
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/site-packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/site-packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/site-packages/django/core/checks/urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/site-packages/django/core/checks/urls.py", line 26, in check_resolver
return check_method()
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/site-packages/django/urls/resolvers.py", line 254, in check
for pattern in self.url_patterns:
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/site-packages/django/urls/resolvers.py", line 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
return import_module(self.urlconf_name)
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/yelesee/Desktop/Mirab/Mirab/Mirab/urls.py", line 26, in <module>
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 50, in include
urlconf_module = import_module(urlconf_module)
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/yelesee/Desktop/Mirab/Mirab/web/urls.py", line 5, in <module>
from . import views
File "/home/yelesee/Desktop/Mirab/Mirab/web/views.py", line 25, in <module>
from lists import *
File "/home/yelesee/Desktop/Mirab/Mirab/web/lists.py", line 6, in <module>
tree = et.parse(xml_file)
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/xml/etree/ElementTree.py", line 1182, in parse
tree.parse(source, parser)
File "/home/yelesee/anaconda3/envs/venv/lib/python2.7/xml/etree/ElementTree.py", line 647, in parse
source = open(source, "rb")
IOError: [Errno 2] No such file or directory: '/home/yelesee/Desktop/Mirab/Mirab/web/data/fuzzy.xml'

Related

Error while running simple django app

knysys#kshahidLT ~/Desktop/firsrproject $ python manage.py runserver
Performing system checks...
Unhandled exception in thread started by <function wrapper at 0x7fbcdea6e050>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 125, in inner_run
self.check(display_num_errors=True)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 26, in check_resolver
return check_method()
File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 254, in check
for pattern in self.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 398, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/knysys/Desktop/firsrproject/firsrproject/urls.py", line 22, in <module>
url(r'^', include('marcador.urls')),
File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py", line 50, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/knysys/Desktop/firsrproject/marcador/urls.py", line 6, in <module>
name='marcador_bookmark_user'),
File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py", line 85, in url
raise TypeError('view must be a callable or a list/tuple in the case of include().')
TypeError: view must be a callable or a list/tuple in the case of include().
From the error logs, it seems that your urlpatterns contains strings on line number 22 in urls.py.
In django 1.10, you cannot pass import paths to url(), need to pass the view function.
change this url(r'^', include('marcador.urls')) to url(r'^posts/$', postSuccess) and you need to import from marcador.views import postSuccess.
Suppose your marcador.views.py :
from django.shortcuts import render
from django.http import HttpResponse
def postSuccess(request):
response = "<h1>Success</h1>"
return HttpResponse(response)

"cannot import name Polygon" in geodjango

I am trying to follow this simple tutorial to show markers on my leaflet meap on my webpage. However, I get the following error:
from django.contrib.gis.geos.geometry import Polygon ImportError:
cannot import name Polygon
as a result of this statement from djgeojson.views import GeoJSONLayerView in my urls.py
I'm not sure how to solve this, I have installed all the required dependencies for geodjango and can't find a package called 'Polygon'..
Here's the full error:
Unhandled exception in thread started by <function wrapper at 0x7fbe7c083050>
Traceback (most recent call last):
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 116, in inner_run
self.check(display_num_errors=True)
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/core/management/base.py", line 426, in check
include_deployment_checks=include_deployment_checks,
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/core/checks/registry.py", line 75, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/core/checks/urls.py", line 10, in check_url_config
return check_resolver(resolver)
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/core/checks/urls.py", line 19, in check_resolver
for pattern in resolver.url_patterns:
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 417, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 410, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/mohamed/Dropbox/newsparse/newsparser/src/newsparser/urls.py", line 22, in <module>
url(r'^', include('textnews.urls')),
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 52, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/mohamed/Dropbox/newsparse/newsparser/src/textnews/urls.py", line 19, in <module>
from djgeojson.views import GeoJSONLayerView
File "/home/mohamed/Dropbox/newsparse/newsparser/local/lib/python2.7/site-packages/djgeojson/views.py", line 6, in <module>
from django.contrib.gis.geos.geometry import Polygon
ImportError: cannot import name Polygon
The import seems broken with Django 1.9 https://github.com/makinacorpus/django-geojson/issues/68

Django Tutorial 1

I began to learn Django, now I'm creating my first app, I followed every step in the tutorial (https://docs.djangoproject.com/en/1.9/intro/tutorial01/) but it doesn't work and it throws me the following error lines when doing python manage.py runserver:
Unhandled exception in thread started by <function wrapper at 0x7ffdfa76d8c0>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver .py", line 116, in inner_run
self.check(display_num_errors=True)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 426 , in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/registry.py", line 75, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 10, in check_url_config
return check_resolver(resolver)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 19, in check_resolver
for pattern in resolver.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 417, i n url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 410, i n urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/boss/Descargas/Python-2.7.5/mysite/testsite/testsite/urls.py", line 21, in <module>
url(r'^polls/', include('polls.urls')),
NameError: name 'include' is not defined
You forgot to import include in mysite/urls.py.
from django.conf.urls import include, url

Mezzanine ImportError when running tests

I have recently upgraded the version of Django from 1.5.5 to 1.6.2 and Mezzanine to 3.0.9.
When I run
python manage.py test
All the tests run without problem.
But When I run project specific tests using
python manage.py test <project-name>
Then I get ImportError. I get that its something to do with Circular Imports.
Here is the stack trace. Please help.
======================================================================
ERROR: Failure: ImportError (cannot import name DisplayableAdmin)
---------------------------------------------------------------------- Traceback (most recent call last): File
"/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/nose/loader.py",
line 411, in loadTestsFromName
addr.filename, addr.module) File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/nose/importer.py",
line 47, in importFromPath
return self.importFromDir(dir_path, fqname) File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/nose/importer.py",
line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc) File "/Users/devarajn/repos/pari/pari/album/tests.py", line 8, in
from pari.album.admin import AlbumAdmin, AlbumImageInline File "/Users/devarajn/repos/pari/pari/album/admin.py", line 2, in
from mezzanine.core.admin import TabularDynamicInlineAdmin File
"/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/mezzanine/core/admin.py",
line 4, in
from django.contrib.auth.admin import UserAdmin File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/django/contrib/auth/admin.py", line 182, in
admin.site.register(Group, GroupAdmin) File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/mezzanine/boot/lazy_admin.py", line 26, in register
super(LazyAdminSite, self).register(*args, **kwargs) File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 92, in register
admin_class.validate(model) File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/django/contrib/admin/options.py", line 105, in validate
validator = cls.validator_class() File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/django/contrib/admin/validation.py",
line 20, in init
models.get_apps() File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/django/db/models/loading.py",
line 139, in get_apps
self._populate() File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/django/db/models/loading.py",
line 78, in _populate
self.load_app(app_name) File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/django/db/models/loading.py",
line 99, in load_app
models = import_module('%s.models' % app_name) File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/django/utils/importlib.py",
line 40, in import_module
import(name) File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/debug_toolbar/models.py",
line 63, in
patch_root_urlconf() File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/debug_toolbar/models.py",
line 51, in patch_root_urlconf
reverse('djdt:render_panel') File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/django/core/urlresolvers.py",
line 480, in reverse
app_list = resolver.app_dict[ns] File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/django/core/urlresolvers.py",
line 310, in app_dict
self._populate() File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/django/core/urlresolvers.py",
line 262, in _populate
for pattern in reversed(self.url_patterns): File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/django/core/urlresolvers.py",
line 346, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File
"/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/django/core/urlresolvers.py",
line 341, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name) File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/django/utils/importlib.py",
line 40, in import_module
import(name) File "/Users/devarajn/repos/pari/pari/urls.py", line 7, in
admin.autodiscover() File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/mezzanine/boot/init.py",
line 77, in autodiscover
django_autodiscover(*args, **kwargs) File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/django/contrib/admin/init.py",
line 29, in autodiscover
import_module('%s.admin' % app) File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/django/utils/importlib.py",
line 40, in import_module
import(name) File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/mezzanine/forms/admin.py",
line 24, in
from mezzanine.pages.admin import PageAdmin File "/Users/devarajn/.pythonbrew/venvs/Python-2.7.3/pari/lib/python2.7/site-packages/mezzanine/pages/admin.py",
line 12, in
from mezzanine.core.admin import DisplayableAdmin, DisplayableAdminForm ImportError: cannot import name
DisplayableAdmin
django-debug-toolbar module was causing the issue.
I rolled back from django-debug-toolbar v1.0.1 to v0.11.
This fixed the error.

Installation error in with byteflow-0.7

I am installing byteflow-0.7 on python 2.6.5 with django 1.3 on windows7(64-bits). Database used is MySQL 5.0.51b on wamp 2.0 server. I installed all the prerequisites well and have run the syncdb command. That run well and the database was created successfully. When I run the server and hit the localhost:8000 on my browser, I see the following:
Traceback (most recent call last):
File "C:\Python26\lib\site-packages\django\core\servers\basehttp.py", line 283, in run
self.result = application(self.environ, self.start_response)
File "C:\Python26\lib\site-packages\django\contrib\staticfiles\handlers.py", line 68, in __call__
return self.application(environ, start_response)
File "C:\Python26\lib\site-packages\django\core\handlers\wsgi.py", line 250, in __call__
self.load_middleware()
File "C:\Python26\lib\site-packages\django\core\handlers\base.py", line 45, in load_middleware
mod = import_module(mw_module)
File "C:\Python26\lib\site-packages\django\utils\importlib.py", line 35, in import_module
__import__(name)
File "D:\djangowork\piranha-byteflow-98c3681f5a8f\apps\pingback\middleware.py", line 3, in <module>
class PingbackMiddleware(object):
File "D:\djangowork\piranha-byteflow-98c3681f5a8f\apps\pingback\middleware.py", line 4, in PingbackMiddleware
xmlrpc_url = reverse('xmlrpc')
File "C:\Python26\lib\site-packages\django\core\urlresolvers.py", line 391, in reverse
*args, **kwargs)))
File "C:\Python26\lib\site-packages\django\core\urlresolvers.py", line 312, in reverse
possibilities = self.reverse_dict.getlist(lookup_view)
File "C:\Python26\lib\site-packages\django\core\urlresolvers.py", line 229, in _get_reverse_dict
self._populate()
File "C:\Python26\lib\site-packages\django\core\urlresolvers.py", line 197, in _populate
for pattern in reversed(self.url_patterns):
File "C:\Python26\lib\site-packages\django\core\urlresolvers.py", line 279, in _get_url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Python26\lib\site-packages\django\core\urlresolvers.py", line 274, in _get_urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "C:\Python26\lib\site-packages\django\utils\importlib.py", line 35, in import_module
__import__(name)
File "D:\djangowork\piranha-byteflow-98c3681f5a8f\urls.py", line 45, in <module>
url(r'^admin/(.*)', admin.site.root, name='admin'),
AttributeError: 'AdminSite' object has no attribute 'root'
What do I need to do?
It seems that AdminSite.root had been marked deprecated in Django 1.1 and apparently it is now removed in Django 1.3. So you either have to downgrade Django to 1.0 (as this is what ByteFlow website says in requirements) or use a newer Byteflow version that has this issue fixed.
PS. Found a fix in a forked repo.

Categories

Resources