我不知道发生了什么。我遵循有关部署Web应用程序的说明。 migragte命令可以正常工作,并且不会出现任何错误,但是当我可以使用ip或域名访问该网站时,就会出现类似的错误,并且该网站无法正常运行,并且该Web应用程序在本地运行良好。
这些是错误日志。
Environment:
Request Method: GET
Request URL: http://35.182.146.123:8080/api/sidewalk/
Django Version: 2.1.7
Python Version: 3.5.2
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'frontend',
'rest_framework',
'api.apps.ApiConfig',
'corsheaders',
'cloudinary']
Installed Middleware:
['corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/mysql/base.py" in execute
71. return self.cursor.execute(query, args)
File "/usr/local/lib/python3.5/dist-packages/pymysql/cursors.py" in execute
170. result = self._query(query)
File "/usr/local/lib/python3.5/dist-packages/pymysql/cursors.py" in _query
328. conn.query(q)
File "/usr/local/lib/python3.5/dist-packages/pymysql/connections.py" in query
517. self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.5/dist-packages/pymysql/connections.py" in _read_query_result
732. result.read()
File "/usr/local/lib/python3.5/dist-packages/pymysql/connections.py" in read
1075. first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.5/dist-packages/pymysql/connections.py" in _read_packet
684. packet.check_error()
File "/usr/local/lib/python3.5/dist-packages/pymysql/protocol.py" in check_error
220. err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.5/dist-packages/pymysql/err.py" in raise_mysql_exception
109. raise errorclass(errno, errval)
The above exception ((1146, "Table 'stepsdb.api_sidewalk' doesn't exist")) was the direct cause of the following exception:
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py" in _get_response
126. response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py" in _get_response
124. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.5/dist-packages/django/views/decorators/csrf.py" in wrapped_view
54. return view_func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/viewsets.py" in view
116. return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/views.py" in dispatch
495. response = self.handle_exception(exc)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/views.py" in handle_exception
455. self.raise_uncaught_exception(exc)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/views.py" in dispatch
492. response = handler(request, *args, **kwargs)
File "/var/www/html/steps/api/views/sidewalkView.py" in list
451. result = SidewalkListSerializer(qs, many=True).data
File "/usr/local/lib/python3.5/dist-packages/rest_framework/serializers.py" in data
768. ret = super(ListSerializer, self).data
File "/usr/local/lib/python3.5/dist-packages/rest_framework/serializers.py" in data
262. self._data = self.to_representation(self.instance)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/serializers.py" in to_representation
686. self.child.to_representation(item) for item in iterable
File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py" in __iter__
1339. self._fetch_all()
File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py" in _fetch_all
1326. self._result_cache = list(self.iterator())
File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py" in iterator
1349. query = iter(self.query)
File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/query.py" in __iter__
96. self._execute_query()
File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/query.py" in _execute_query
130. self.cursor.execute(self.sql, params)
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py" in execute
100. return super().execute(sql, params)
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py" in execute
68. return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py" in _execute_with_wrappers
77. return executor(sql, params, many, context)
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.5/dist-packages/django/db/utils.py" in __exit__
89. raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.5/dist-packages/django/db/backends/mysql/base.py" in execute
71. return self.cursor.execute(query, args)
File "/usr/local/lib/python3.5/dist-packages/pymysql/cursors.py" in execute
170. result = self._query(query)
File "/usr/local/lib/python3.5/dist-packages/pymysql/cursors.py" in _query
328. conn.query(q)
File "/usr/local/lib/python3.5/dist-packages/pymysql/connections.py" in query
517. self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python3.5/dist-packages/pymysql/connections.py" in _read_query_result
732. result.read()
File "/usr/local/lib/python3.5/dist-packages/pymysql/connections.py" in read
1075. first_packet = self.connection._read_packet()
File "/usr/local/lib/python3.5/dist-packages/pymysql/connections.py" in _read_packet
684. packet.check_error()
File "/usr/local/lib/python3.5/dist-packages/pymysql/protocol.py" in check_error
220. err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.5/dist-packages/pymysql/err.py" in raise_mysql_exception
109. raise errorclass(errno, errval)
Exception Type: ProgrammingError at /api/sidewalk/
Exception Value: (1146, "Table 'stepsdb.api_sidewalk' doesn't exist")