python - Write permission denied when writing to logs using Django NonRel -
new web dev here. i'm trying run basic web application using djangoappengine fork of django nonrel 1.6. i'm running locally, logging doesn't work. here's error:
python manage.py runserver info 2015-07-07 18:22:18,926 sdk_update_checker.py:229] checking updates sdk. info 2015-07-07 18:22:19,157 sdk_update_checker.py:257] sdk date. info 2015-07-07 18:22:19,218 api_server.py:204] starting api server at: http://localhost:51763 info 2015-07-07 18:22:19,225 dispatcher.py:197] starting module "default" running at: http://127.0.0.1:8080 info 2015-07-07 18:22:19,226 admin_server.py:118] starting admin server at: http://localhost:8000 error 2015-07-07 18:22:22,080 wsgi.py:263] traceback (most recent call last): file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/runtime/wsgi.py", line 240, in handle handler = _config_handle.add_wsgi_middleware(self._loadhandler()) file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _loadhandler handler, path, err = loadobject(self._handler) file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/runtime/wsgi.py", line 96, in loadobject __import__(cumulative_path) file "/users/prog/desktop/djangononrel/project2/djangoappengine/main/__init__.py", line 37, in <module> setup_env(settings.dev_appserver_version) file "/users/prog/desktop/djangononrel/project2/django/conf/__init__.py", line 54, in __getattr__ self._setup(name) file "/users/prog/desktop/djangononrel/project2/django/conf/__init__.py", line 50, in _setup self._configure_logging() file "/users/prog/desktop/djangononrel/project2/django/conf/__init__.py", line 80, in _configure_logging logging_config_func(self.logging) file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/logging/config.py", line 794, in dictconfig dictconfigclass(config).configure() file "/library/frameworks/python.framework/versions/2.7/lib/python2.7/logging/config.py", line 576, in configure '%r: %s' % (name, e)) valueerror: unable configure handler 'file': [errno 30] read-only file system: '/users/prog/documents/guestbook.log' info 2015-07-07 18:22:22,086 module.py:812] default: "get /_ah/warmup http/1.1" 500 -
the server continues run, can see, can't write log being generated. i've tried these fixes far: -used chmod 755 , 777 change permissions on full path -changed path current one(old 1 creating log in project folder) -used chmod 755 , 777 change permissions on new full path
here's setting.py code:
# django settings myapp project. # initialize app engine , import default settings (db backend, etc.). # if want use different backend have remove occurences # of "djangoappengine" file. djangoappengine.settings_base import * import os admins = ( # ('your name', 'your_email@example.com'), ) managers = admins # activate django-dbindexer default database databases['default'] = {'engine': 'dbindexer', 'target': databases['default']} autoload_siteconf = 'indexes' # hosts/domain names valid site; required if debug false allowed_hosts = [] # local time zone installation. choices can found here: # although not choices may available on operating systems. # in windows environment must set system time zone. time_zone = 'america/chicago' # language code installation. choices can found here: # http://www.i18nguy.com/unicode/language-identifiers.html language_code = 'en-us' site_id = 1 # if set false, django make optimizations not # load internationalization machinery. use_i18n = true # if set false, django not format dates, numbers , # calendars according current locale. use_l10n = true # if set false, django not use timezone-aware datetimes. use_tz = false # absolute filesystem path directory hold user-uploaded files. # example: "/var/www/example.com/media/" media_root = os.path.join(os.path.dirname(__file__), 'media') # url handles media served media_root. make sure use # trailing slash. # examples: "http://example.com/media/", "http://media.example.com/" media_url = '' # absolute path directory static files should collected to. # don't put in directory yourself; store static files # in apps' "static/" subdirectories , in staticfiles_dirs. # example: "/var/www/example.com/static/" static_root = '' # url prefix static files. # example: "http://example.com/static/", "http://static.example.com/" static_url = '/static/' # additional locations of static files staticfiles_dirs = ( # put strings here, "/home/html/static" or "c:/www/django/static". # use forward slashes, on windows. # don't forget use absolute paths, not relative paths. ) # list of finder classes know how find static files in # various locations. staticfiles_finders = ( 'django.contrib.staticfiles.finders.filesystemfinder', 'django.contrib.staticfiles.finders.appdirectoriesfinder', # 'django.contrib.staticfiles.finders.defaultstoragefinder', ) # make unique, , don't share anybody. secret_key = 'ilpeey9j&dk@4u5gx!iv)0hnxm*eu=nfpmvn92!n)+mc3#q0t5' # list of callables know how import templates various sources. template_loaders = ( 'django.template.loaders.filesystem.loader', 'django.template.loaders.app_directories.loader', # 'django.template.loaders.eggs.loader', ) middleware_classes = ( # loads index definitions, has come first 'autoload.middleware.autoloadmiddleware', 'django.middleware.common.commonmiddleware', 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware', # uncomment next line simple clickjacking protection: # 'django.middleware.clickjacking.xframeoptionsmiddleware', ) template_context_processors = ( 'django.contrib.auth.context_processors.auth', 'django.core.context_processors.request' ) login_redirect_url = '/guestbook/' admin_media_prefix = '/media/admin/' root_urlconf = 'urls' template_dirs = ( '/users/prog/desktop/djangononrel/project2/templates/guestbook/', # put strings here, "/home/html/django_templates" or "c:/www/django/templates". # use forward slashes, on windows. # don't forget use absolute paths, not relative paths. ) installed_apps = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', # uncomment next line enable admin: # 'django.contrib.admin', # uncomment next line enable admin documentation: # 'django.contrib.admindocs', 'djangotoolbox', 'autoload', 'dbindexer', 'guestbook', # djangoappengine should come last, can override few manage.py commands 'djangoappengine', ) # sample logging configuration. tangible logging # performed configuration send email # site admins on every http 500 error when debug=false. # see http://docs.djangoproject.com/en/dev/topics/logging # more details on how customize logging configuration. logging = { 'version': 1, 'disable_existing_loggers': false, 'formatters': { 'verbose': { 'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s", 'datefmt' : "%d/%b/%y %h:%m:%s" }, 'simple': { 'format': '%(levelname)s %(message)s' }, }, 'handlers': { 'file': { 'level': 'debug', 'class': 'logging.filehandler', 'filename': '/users/prog/documents/guestbook.log', 'formatter': 'verbose' }, }, 'loggers': { 'django': { 'handlers':['file'], 'propagate': true, 'level':'debug', }, 'guestbook': { 'handlers': ['file'], 'level': 'debug', }, } }
please let me know if need else me.
you need fix permissions chmod command
try command:
chmod 775 /users/prog/documents/guestbook.log
Comments
Post a Comment