teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

該当行の記入

2018/10/26 00:25

投稿

nuko3
nuko3

スコア31

title CHANGED
File without changes
body CHANGED
@@ -137,6 +137,16 @@
137
137
 
138
138
  STATIC_ROOT = posixpath.join(*(BASE_DIR.split(os.path.sep) + ['static']))
139
139
  ```
140
+ \mysite\mysite\env\lib\site-packages\django\contrib\admin\sites.pyの186行目にあった関数
141
+ ```
142
+ def has_permission(self, request):
143
+ """
144
+ Return True if the given HttpRequest has permission to view
145
+ *at least one* page in the admin site.
146
+ """
147
+ return request.user.is_active and request.user.is_staff #←186行目。userの部分を変えると'user'の部分が変わります
148
+ ```
149
+
140
150
  サーバー設定ファイルというのがわからないのですがこれでしょうか...?
141
151
  ![イメージ説明](df1dbb29da2cb2b591bfbd791812749b.png)
142
152
 

1

settings.py等の記入

2018/10/26 00:25

投稿

nuko3
nuko3

スコア31

title CHANGED
File without changes
body CHANGED
@@ -7,7 +7,139 @@
7
7
  'WSGIRequest' object has no attribute 'user'
8
8
  ```
9
9
  ![イメージ説明](d76107afdb3203d718b37ad1b955f16d.png)
10
+ settings.pyは以下です。
11
+ ```
12
+ #mysite\settings.py
13
+ """
14
+ Django settings for mysite project.
10
15
 
16
+ Generated by 'django-admin startproject' using Django 1.9.1.
17
+
18
+ For more information on this file, see
19
+ https://docs.djangoproject.com/en/1.9/topics/settings/
20
+
21
+ For the full list of settings and their values, see
22
+ https://docs.djangoproject.com/en/1.9/ref/settings/
23
+ """
24
+
25
+ import os
26
+ import posixpath
27
+
28
+ # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
29
+ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
30
+
31
+
32
+ # Quick-start development settings - unsuitable for production
33
+ # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
34
+
35
+ # SECURITY WARNING: keep the secret key used in production secret!
36
+ SECRET_KEY = '4db48398-12d9-4b59-815b-16b1a600008b'
37
+
38
+ # SECURITY WARNING: don't run with debug turned on in production!
39
+ DEBUG = True
40
+
41
+ ALLOWED_HOSTS = []
42
+
43
+
44
+ # Application definition
45
+
46
+ INSTALLED_APPS = [
47
+ # Add your apps here to enable them
48
+ 'polls.apps.pollsConfig',
49
+ 'django.contrib.admin',
50
+ 'django.contrib.auth',
51
+ 'django.contrib.contenttypes',
52
+ 'django.contrib.sessions',
53
+ 'django.contrib.messages',
54
+ 'django.contrib.staticfiles',
55
+ ]
56
+
57
+ MIDDLEWARE_CLASSES = [
58
+ 'django.middleware.security.SecurityMiddleware',
59
+ 'django.contrib.sessions.middleware.SessionMiddleware',
60
+ 'django.middleware.common.CommonMiddleware',
61
+ 'django.middleware.csrf.CsrfViewMiddleware',
62
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
63
+ 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
64
+ 'django.contrib.messages.middleware.MessageMiddleware',
65
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
66
+ ]
67
+
68
+ ROOT_URLCONF = 'mysite.urls'
69
+
70
+ TEMPLATES = [
71
+ {
72
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
73
+ 'DIRS': [],
74
+ 'APP_DIRS': True,
75
+ 'OPTIONS': {
76
+ 'context_processors': [
77
+ 'django.template.context_processors.debug',
78
+ 'django.template.context_processors.request',
79
+ 'django.contrib.auth.context_processors.auth',
80
+ 'django.contrib.messages.context_processors.messages',
81
+ ],
82
+ },
83
+ },
84
+ ]
85
+
86
+ WSGI_APPLICATION = 'mysite.wsgi.application'
87
+
88
+
89
+ # Database
90
+ # https://docs.djangoproject.com/en/1.9/ref/settings/#databases
91
+
92
+ DATABASES = {
93
+ 'default': {
94
+ 'ENGINE': 'django.db.backends.sqlite3',
95
+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
96
+ },
97
+ }
98
+
99
+
100
+ # Password validation
101
+ # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
102
+
103
+ AUTH_PASSWORD_VALIDATORS = [
104
+ {
105
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
106
+ },
107
+ {
108
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
109
+ },
110
+ {
111
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
112
+ },
113
+ {
114
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
115
+ },
116
+ ]
117
+
118
+
119
+ # Internationalization
120
+ # https://docs.djangoproject.com/en/1.9/topics/i18n/
121
+
122
+ LANGUAGE_CODE = 'en-us'
123
+
124
+ TIME_ZONE = 'UTC'
125
+
126
+ USE_I18N = True
127
+
128
+ USE_L10N = True
129
+
130
+ USE_TZ = True
131
+
132
+
133
+ # Static files (CSS, JavaScript, Images)
134
+ # https://docs.djangoproject.com/en/1.9/howto/static-files/
135
+
136
+ STATIC_URL = '/static/'
137
+
138
+ STATIC_ROOT = posixpath.join(*(BASE_DIR.split(os.path.sep) + ['static']))
139
+ ```
140
+ サーバー設定ファイルというのがわからないのですがこれでしょうか...?
141
+ ![イメージ説明](df1dbb29da2cb2b591bfbd791812749b.png)
142
+
11
143
  ### バージョン等
12
144
  OS:Windows 10 Pro
13
145
  Python:3.7