这个权限被拒绝的错误意味着什么?

时间:2018-05-10 13:23:50

标签: python django permission-denied otree

错误:我试图将我的oTree实验游戏放在devserver中,这个错误就出现了。我现在不知道它意味着什么,因为它与我的代码无关?我想是吗?

请求方法:GET 请求网址:http://localhost:8000/p/wypb8dnj/Intro/Understanding1/3/

Django版本:1.11.2 Python版本:3.6.3 已安装的应用程序:

['otree',
 'django.contrib.auth',
 'django.forms',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'channels',
 'huey.contrib.djhuey',
 'idmap',
 'raven.contrib.django.raven_compat',
 'radiogrid',
 'Intro']
Installed Middleware:
['otree.middleware.CheckDBMiddleware',
 'whitenoise.middleware.WhiteNoiseMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware']


Template error:
In template c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\otree\templates\otree\Base.html, error at line 0
   13   1 : {% load staticfiles %}
   2 : {% load i18n %}
   3 : {% load otree %}
   4 : 
   5 : <!DOCTYPE html>
   6 : <html>
   7 : <head>
   8 :     <title>{% block head_title %}{% block title %}
   9 :     {% endblock %}{% endblock %}</title>
   10 : 


Traceback:

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\otree\views\abstract.py" in dispatch
  236.                     response.render()

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\response.py" in render
  107.             self.content = self.rendered_content

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\response.py" in rendered_content
  84.         content = template.render(context, self._request)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\backends\django.py" in render
  66.             return self.template.render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in render
  207.                     return self._render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in _render
  199.         return self.nodelist.render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in render
  990.                 bit = node.render_annotated(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in render_annotated
  957.             return self.render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\loader_tags.py" in render
  177.             return compiled_parent._render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in _render
  199.         return self.nodelist.render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in render
  990.                 bit = node.render_annotated(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in render_annotated
  957.             return self.render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\loader_tags.py" in render
  177.             return compiled_parent._render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in _render
  199.         return self.nodelist.render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in render
  990.                 bit = node.render_annotated(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in render_annotated
  957.             return self.render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\loader_tags.py" in render
  177.             return compiled_parent._render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in _render
  199.         return self.nodelist.render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in render
  990.                 bit = node.render_annotated(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in render_annotated
  957.             return self.render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\loader_tags.py" in render
  72.                 result = block.nodelist.render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in render
  990.                 bit = node.render_annotated(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in render_annotated
  957.             return self.render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\loader_tags.py" in render
  72.                 result = block.nodelist.render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in render
  990.                 bit = node.render_annotated(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\base.py" in render_annotated
  957.             return self.render(context)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\loader_tags.py" in render
  204.                     template = context.template.engine.get_template(template_name)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\engine.py" in get_template
  162.         template, origin = self.find_template(template_name)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\engine.py" in find_template
  136.                         name, template_dirs=dirs, skip=skip,

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\loaders\base.py" in get_template
  38.                 contents = self.get_contents(origin)

File "c:\users\welschre\appdata\local\programs\python\python36\lib\site-packages\django\template\loaders\filesystem.py" in get_contents
  28.             with io.open(origin.name, encoding=self.engine.file_charset) as fp:

Exception Type: PermissionError at /p/wypb8dnj/Intro/Understanding1/3/
Exception Value: [Errno 13] Permission denied: 'C:\\Users\\WelschRe\\experiment\\_templates'

我的setting.py:

from os import environ
import os
import dj_database_url
import otree.settings


BASE_DIR = os.path.dirname(os.path.abspath(__file__))

# the environment variable OTREE_PRODUCTION controls whether Django runs in
# DEBUG mode. If OTREE_PRODUCTION==1, then DEBUG=False
if environ.get('OTREE_PRODUCTION') not in {None, '', '0'}:
    DEBUG = False
else:
    DEBUG = True


# don't share this with anybody.
#SECRET_KEY = 'a!1g82ccjgfst65w=-__$0-wrc0)x93=@ovs(f)y1&+(n*7fx2'
SECRET_KEY = '2g942lbviezc5hc=zff2*ptc^zn$91@h$f&%%1t75%_2b#s_vh'

DATABASES = {
    'default': dj_database_url.config(
        # Rather than hardcoding the DB parameters here,
        # it's recommended to set the DATABASE_URL environment variable.
        # This will allow you to use SQLite locally, and postgres/mysql
        # on the server
        # Examples:
        # export DATABASE_URL=postgres://USER:PASSWORD@HOST:PORT/NAME
        # export DATABASE_URL=mysql://USER:PASSWORD@HOST:PORT/NAME

        # fall back to SQLite if the DATABASE_URL env var is missing
        default='sqlite:///' + os.path.join(BASE_DIR, 'db.sqlite3')
    )
}

# AUTH_LEVEL:
# this setting controls which parts of your site are freely accessible,
# and which are password protected:
# - If it's not set (the default), then the whole site is freely accessible.
# - If you are launching a study and want visitors to only be able to
#   play your app if you provided them with a start link, set it to STUDY.
# - If you would like to put your site online in public demo mode where
#   anybody can play a demo version of your game, but not access the rest
#   of the admin interface, set it to DEMO.

# for flexibility, you can set it in the environment variable OTREE_AUTH_LEVEL
AUTH_LEVEL = environ.get('OTREE_AUTH_LEVEL')

ADMIN_USERNAME = 'admin'
# for security, best to set admin password in an environment variable
ADMIN_PASSWORD = environ.get('OTREE_ADMIN_PASSWORD')


# setting for integration with AWS Mturk
AWS_ACCESS_KEY_ID = environ.get('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = environ.get('AWS_SECRET_ACCESS_KEY')


# e.g. EUR, CAD, GBP, CHF, CNY, JPY
REAL_WORLD_CURRENCY_CODE = 'USD'
USE_POINTS = True



# e.g. en, de, fr, it, ja, zh-hans
# see: https://docs.djangoproject.com/en/1.9/topics/i18n/#term-language-code
LANGUAGE_CODE = 'en'

# if an app is included in SESSION_CONFIGS, you don't need to list it here
INSTALLED_APPS = ['otree','radiogrid']

SENTRY_DSN = 'http://b1e2f44765e24ec0bde684ffa5301308:b0c9994fc8074b2ea09cfa71e53bcbf5@sentry.otree.org/276'


DEMO_PAGE_INTRO_HTML = """
<ul>
    <li>
        <a href="https://github.com/oTree-org/otree" target="_blank">
            oTree on GitHub
        </a>.
    </li>
    <li>
        <a href="http://www.otree.org/" target="_blank">
            oTree homepage
        </a>.
    </li>
</ul>
<p>
    Here are various games implemented with oTree. These games are all open
    source, and you can modify them as you wish.
</p>
"""

ROOMS = [
    {
        'name': 'econ101',
        'display_name': 'Econ 101 class',
        'participant_label_file': '_rooms/econ101.txt',
    },
    {
        'name': 'live_demo',
        'display_name': 'Room for live demo (no participant labels)',
    },
]


mturk_hit_settings = {
    'keywords': ['bonus', 'study'],
    'title': 'Title for your experiment',
    'description': 'Description for your experiment',
    'frame_height': 500,
    'preview_template': 'global/MTurkPreview.html',
    'minutes_allotted_per_assignment': 60,
    'expiration_hours': 7*24, # 7 days
    #'grant_qualification_id': 'YOUR_QUALIFICATION_ID_HERE',# to prevent retakes
    'qualification_requirements': []
}


# if you set a property in SESSION_CONFIG_DEFAULTS, it will be inherited by all configs
# in SESSION_CONFIGS, except those that explicitly override it.
# the session config can be accessed from methods in your apps as self.session.config,
# e.g. self.session.config['participation_fee']

SESSION_CONFIG_DEFAULTS = {
    'real_world_currency_per_point': 1.00,
    'participation_fee': 0.00,
    'doc': "",
    'mturk_hit_settings': mturk_hit_settings,
}

SESSION_CONFIGS = [
    {
        'name': 'Real',
        'display_name': 'Decision Game',
        'num_demo_participants': 2,
        'app_sequence':['Intro'],
    },
#    {
#        'name': 'postquestionnaire',
 #       'display_name': 'Test-PostQuestionnaire',
 #       'num_demo_participants': 1,
 #       'app_sequence':['postquestionnaire'],
  #  },
   # {
   #     'name': 'RealTest',
   #     'display_name': 'Test Game',
#    'num_demo_participants': 2,
 #       'app_sequence':['Real'],
  #  },
   # {
   #     'name': 'AlternativeChart',
  #      'display_name': 'ChartTest',
   #     'num_demo_participants': 2,
  #      'app_sequence':['Now'],
   # },
]


# anything you put after the below line will override
# oTree's default settings. Use with caution.
otree.settings.augment_settings(globals())

0 个答案:

没有答案