SteveDiamond / dcp_site

4 stars 5 forks source link

Quiz broken #6

Closed KingBoomie closed 3 years ago

KingBoomie commented 3 years ago

visiting the quiz page doesn't show the quiz and there's a 500 error in the console for a POST to https://dcp.stanford.edu/new_expr:

click for the 500 response content ``` OperationalError at /new_expr (1045, "Access denied for user 'root'@'localhost' (using password: NO)") Request Method: POST Request URL: http://localhost:8000/new_expr Django Version: 1.5.1 Python Executable: /home/dcp/dcp_site/env/bin/python2 Python Version: 2.7.12 Python Path: ['/home/dcp/dcp_site', '/home/dcp/dcp_site/env/bin', '/home/dcp/dcp_site/env/lib/python2.7', '/home/dcp/dcp_site/env/lib/python2.7/plat-x86_64-linux-gnu', '/home/dcp/dcp_site/env/lib/python2.7/lib-tk', '/home/dcp/dcp_site/env/lib/python2.7/lib-old', '/home/dcp/dcp_site/env/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/home/dcp/dcp_site/env/local/lib/python2.7/site-packages'] Server time: Fri, 4 Jun 2021 08:29:43 -0700 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'dcp_sandbox', 'south') Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware') Traceback: File "/home/dcp/dcp_site/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response 115. response = callback(request, *callback_args, **callback_kwargs) File "/home/dcp/dcp_site/dcp_sandbox/views.py" in new_expr 102. request.POST['dcp'] == true_str) File "/home/dcp/dcp_site/dcp_sandbox/models.py" in get_random_expression 39. prob_increase) File "/home/dcp/dcp_site/dcp_sandbox/models.py" in get_random_expression_tree 58. Q(terminal=terminal) | Q(terminal=True), File "/home/dcp/dcp_site/env/local/lib/python2.7/site-packages/django/db/models/query.py" in __len__ 92. self._result_cache.extend(self._iter) File "/home/dcp/dcp_site/env/local/lib/python2.7/site-packages/django/db/models/query.py" in iterator 301. for row in compiler.results_iter(): File "/home/dcp/dcp_site/env/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in results_iter 775. for rows in self.execute_sql(MULTI): File "/home/dcp/dcp_site/env/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql 839. cursor = self.connection.cursor() File "/home/dcp/dcp_site/env/local/lib/python2.7/site-packages/django/db/backends/__init__.py" in cursor 324. cursor = self.make_debug_cursor(self._cursor()) File "/home/dcp/dcp_site/env/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py" in _cursor 405. self.connection = Database.connect(**kwargs) File "/home/dcp/dcp_site/env/local/lib/python2.7/site-packages/MySQLdb/__init__.py" in Connect 81. return Connection(*args, **kwargs) File "/home/dcp/dcp_site/env/local/lib/python2.7/site-packages/MySQLdb/connections.py" in __init__ 193. super(Connection, self).__init__(*args, **kwargs2) Exception Type: OperationalError at /new_expr Exception Value: (1045, "Access denied for user 'root'@'localhost' (using password: NO)") Request information: GET: No GET data POST: prob_increase = u'20' positive = u'false' concave = u'false' negative = u'false' prob_terminate = u'0.05' convex = u'true' true_str = u'true' dcp = u'true' FILES: No FILES data COOKIES: csrftoken = '7VTVCfcNBH1attIteG31tKMsCPKwQpNh' _ga = 'GA1.2.1059466306.1622820412' _gid = 'GA1.2.1032619607.1622820412' META: HTTP_X_FORWARDED_SERVER = 'dcp.stanford.edu' HTTP_REFERER = 'https://dcp.stanford.edu/quiz' HTTP_X_FORWARDED_HOST = 'dcp.stanford.edu' SERVER_SOFTWARE = 'gunicorn/19.9.0' SCRIPT_NAME = u'' HTTP_X_CSRFTOKEN = '7VTVCfcNBH1attIteG31tKMsCPKwQpNh' REQUEST_METHOD = 'POST' PATH_INFO = u'/new_expr' HTTP_ORIGIN = 'https://dcp.stanford.edu' SERVER_PROTOCOL = 'HTTP/1.1' QUERY_STRING = '' CONTENT_LENGTH = '115' HTTP_USER_AGENT = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0' HTTP_CONNECTION = 'Keep-Alive' HTTP_COOKIE = 'csrftoken=7VTVCfcNBH1attIteG31tKMsCPKwQpNh; _ga=GA1.2.1059466306.1622820412; _gid=GA1.2.1032619607.1622820412' SERVER_NAME = '127.0.0.1' REMOTE_ADDR = '127.0.0.1' wsgi.url_scheme = 'http' SERVER_PORT = '8000' HTTP_PRAGMA = 'no-cache' HTTP_X_REQUESTED_WITH = 'XMLHttpRequest' REMOTE_PORT = '52284' wsgi.input = HTTP_HOST = 'localhost:8000' wsgi.multithread = False HTTP_CACHE_CONTROL = 'no-cache' HTTP_ACCEPT = '*/*' wsgi.version = RAW_URI = '/new_expr' wsgi.run_once = False wsgi.errors = wsgi.multiprocess = False HTTP_ACCEPT_LANGUAGE = 'en-US,en;q=0.5' gunicorn.socket = CONTENT_TYPE = 'application/x-www-form-urlencoded; charset=UTF-8' HTTP_X_FORWARDED_FOR = '193.40.12.10' wsgi.file_wrapper = '' CSRF_COOKIE = u'7VTVCfcNBH1attIteG31tKMsCPKwQpNh' HTTP_ACCEPT_ENCODING = 'gzip, deflate, br' Settings: Using settings module dcp_site.settings USE_L10N = True USE_THOUSAND_SEPARATOR = False CSRF_COOKIE_SECURE = False LANGUAGE_CODE = 'en-us' ROOT_URLCONF = 'dcp_site.urls' MANAGERS = DEFAULT_CHARSET = 'utf-8' STATIC_ROOT = '/srv/dcp.stanford.edu/app/static/' TIME_INPUT_FORMATS = ALLOWED_HOSTS = ['127.0.0.1', '.stanford.edu/group/dcp/django/'] MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage' EMAIL_SUBJECT_PREFIX = '[Django] ' FILE_UPLOAD_PERMISSIONS = None STATICFILES_FINDERS = SESSION_CACHE_ALIAS = 'default' SESSION_COOKIE_DOMAIN = None SESSION_COOKIE_NAME = 'sessionid' ADMIN_FOR = DCP_DB_PASSWORD = u'********************' DATABASES = {'default': {'ENGINE': 'django.db.backends.mysql', 'TEST_MIRROR': None, 'NAME': 'dcp_site', 'TEST_CHARSET': None, 'TIME_ZONE': 'UTC', 'TEST_COLLATION': None, 'PORT': '', 'HOST': '', 'USER': '', 'TEST_NAME': None, 'PASSWORD': u'********************', 'OPTIONS': {}}} SERVER_EMAIL = 'root@localhost' FILE_UPLOAD_HANDLERS = DEFAULT_CONTENT_TYPE = 'text/html' APPEND_SLASH = True FIRST_DAY_OF_WEEK = 0 DATABASE_ROUTERS = [] YEAR_MONTH_FORMAT = 'F Y' STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' CACHES = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}} SESSION_COOKIE_PATH = '/' MIDDLEWARE_CLASSES = USE_I18N = True THOUSAND_SEPARATOR = ',' SECRET_KEY = u'********************' LANGUAGE_COOKIE_NAME = 'django_language' DEFAULT_INDEX_TABLESPACE = '' TRANSACTIONS_MANAGED = False LOGGING_CONFIG = 'django.utils.log.dictConfig' SEND_BROKEN_LINK_EMAILS = False TEMPLATE_LOADERS = WSGI_APPLICATION = 'dcp_site.wsgi.application' TEMPLATE_DEBUG = True X_FRAME_OPTIONS = 'SAMEORIGIN' AUTHENTICATION_BACKENDS = 'django.contrib.auth.backends.ModelBackend' FORCE_SCRIPT_NAME = None USE_X_FORWARDED_HOST = False SIGNING_BACKEND = 'django.core.signing.TimestampSigner' SESSION_COOKIE_SECURE = False CSRF_COOKIE_DOMAIN = None FILE_CHARSET = 'utf-8' DEBUG = True SESSION_FILE_PATH = None DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage' INSTALLED_APPS = LANGUAGES = COMMENTS_ALLOW_PROFANITIES = False STATICFILES_DIRS = '/home/dcp/dcp_site/dcp_sandbox/static/' PREPEND_WWW = False SECURE_PROXY_SSL_HEADER = SESSION_COOKIE_HTTPONLY = True DEBUG_PROPAGATE_EXCEPTIONS = False MONTH_DAY_FORMAT = 'F j' LOGIN_URL = '/accounts/login/' SESSION_EXPIRE_AT_BROWSER_CLOSE = False TIME_FORMAT = 'P' AUTH_USER_MODEL = 'auth.User' DATE_INPUT_FORMATS = CSRF_COOKIE_NAME = 'csrftoken' EMAIL_HOST_PASSWORD = u'********************' PASSWORD_RESET_TIMEOUT_DAYS = u'********************' CACHE_MIDDLEWARE_ALIAS = 'default' SESSION_SAVE_EVERY_REQUEST = False NUMBER_GROUPING = 0 SESSION_ENGINE = 'django.contrib.sessions.backends.db' CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure' CSRF_COOKIE_PATH = '/' LOGIN_REDIRECT_URL = '/accounts/profile/' DECIMAL_SEPARATOR = '.' IGNORABLE_404_URLS = LOCALE_PATHS = TEMPLATE_STRING_IF_INVALID = '' LOGOUT_URL = '/accounts/logout/' EMAIL_USE_TLS = True FIXTURE_DIRS = EMAIL_HOST = 'smtp.gmail.com' DATE_FORMAT = 'N j, Y' MEDIA_ROOT = '' DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter' ADMINS = FORMAT_MODULE_PATH = None DEFAULT_FROM_EMAIL = 'webmaster@localhost' MEDIA_URL = '' DATETIME_FORMAT = 'N j, Y, P' TEMPLATE_DIRS = SITE_ID = 1 DISALLOWED_USER_AGENTS = ALLOWED_INCLUDE_ROOTS = DCP_DB_USER = '' LOGGING = {'loggers': {'django.db.backends': {'handlers': ['console'], 'propagate': False, 'level': 'DEBUG'}, 'dcp_sandbox': {'handlers': ['console', 'logfile'], 'level': 'DEBUG'}, 'django': {'handlers': ['console'], 'propagate': True, 'level': 'WARN'}}, 'version': 1, 'formatters': {'standard': {'datefmt': '%d/%b/%Y %H:%M:%S', 'format': '[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s'}}, 'disable_existing_loggers': True, 'handlers': {'console': {'formatter': 'standard', 'class': 'logging.StreamHandler', 'level': 'INFO'}, 'logfile': {'backupCount': 2, 'level': 'DEBUG', 'filename': '/home/dcp/dcp_site/logfile', 'formatter': 'standard', 'class': 'logging.handlers.RotatingFileHandler', 'maxBytes': 500000}, 'null': {'class': 'django.utils.log.NullHandler', 'level': 'DEBUG'}}} SHORT_DATE_FORMAT = 'm/d/Y' TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner' CACHE_MIDDLEWARE_KEY_PREFIX = u'********************' TIME_ZONE = 'America/Los_Angeles' FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440 EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' DEFAULT_TABLESPACE = '' TEMPLATE_CONTEXT_PROCESSORS = SESSION_COOKIE_AGE = 1209600 SETTINGS_MODULE = 'dcp_site.settings' USE_ETAGS = False SITE_ROOT = '/home/dcp/dcp_site' LANGUAGES_BIDI = FILE_UPLOAD_TEMP_DIR = None INTERNAL_IPS = STATIC_URL = '/static/' EMAIL_PORT = 587 USE_TZ = True SHORT_DATETIME_FORMAT = 'm/d/Y P' PASSWORD_HASHERS = u'********************' ABSOLUTE_URL_OVERRIDES = {} CACHE_MIDDLEWARE_SECONDS = 600 DATETIME_INPUT_FORMATS = EMAIL_HOST_USER = 'dcp.stanford.edu@gmail.com' PROFANITIES_LIST = u'********************' 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 500 page. ```
SteveDiamond commented 3 years ago

In my effort to fix this I brought the whole site down. Now I need someone at Stanford to look into the situation, hopefully it won't take too long.

SteveDiamond commented 3 years ago

Fixed!