Меню

Ошибка при запуске сервера django

Выпадает ошибка при запуске сервера Django. Вроде пишет, что ошибка в кодировке, но я не знаю как её исправить.

System check identified no issues (0 silenced).
June 06, 2019 - 17:33:13
Django version 2.2.2, using settings 'blogglav.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "c:python37-32Libthreading.py", line 917, in _bootstrap_inner
    self.run()
  File "c:python37-32Libthreading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "D:CODEpy-ruDjangoenvlibsite-packagesdjangoutilsautoreload.py", line 54, in wrapper
    fn(*args, **kwargs)
  File "D:CODEpy-ruDjangoenvlibsite-packagesdjangocoremanagementcommandsrunserver.py", line 139, in inner_run
    ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls)
  File "D:CODEpy-ruDjangoenvlibsite-packagesdjangocoreserversbasehttp.py", line 203, in run
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
  File "D:CODEpy-ruDjangoenvlibsite-packagesdjangocoreserversbasehttp.py", line 67, in __init__
    super().__init__(*args, **kwargs)
  File "c:python37-32Libsocketserver.py", line 452, in __init__
    self.server_bind()
  File "c:python37-32Libwsgirefsimple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
  File "c:python37-32Libhttpserver.py", line 139, in server_bind
    self.server_name = socket.getfqdn(host)
  File "c:python37-32Libsocket.py", line 676, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 5: invalid continuation byte

I have installed python 2.7.10 in windows. I installed django in path c:python27/scripts/with a command pip install django and created project with command django-admin startproject mysite from the same path.

Now to run server i cd to path c:python27/scripts/mysite and ran a command manage.py runserver/ manage.py runserver 0.0.0.0:8000 And this has no any effect.

where did i go wrong, and also i couldn’t run with python console. and i couldn’t redirect to my project from python CMD. all i did is from windows console.

Edit:
Screenshot of execution
enter image description here

xyres's user avatar

xyres

19.8k3 gold badges54 silver badges83 bronze badges

asked Jan 9, 2016 at 9:40

Suman KC's user avatar

12

First step was to set the environment variable.

  • windows key + pause or Control PanelSystem and SecuritySystem
  • Advance system settings (this will open system property)
  • navigate to Advanced tab > Environment variable
  • Edit path — append ;c:python27 in variable value field
  • Restart CMD

then /python manage.py runserver should work

answered Jan 11, 2016 at 2:43

Suman KC's user avatar

Suman KCSuman KC

3,4284 gold badges30 silver badges42 bronze badges

0

Trying setting up a virtualenv for your project.

This same issue happened to me when trying to launch the test server

python .manage.py runserver

from PowerShell on Windows 10. According to the Django site, there might be an issue with the type of arguments being passed from PowerShell.

My workaround was to use a virtualenv. Once that was setup with django installed via pip, the runserver command worked.

answered Aug 22, 2017 at 1:35

Stephen Medeiros's user avatar

The best solution is to install Python from Microsoft Store. In this case, you won’t have to worry about the Environmental Variables and Path. Windows will detect all that automatically.

answered Jun 8, 2020 at 13:25

Shadab Hashmi's user avatar

Try this fix guys:
1. Right click on the windows icon/start on the bottom left and run Windows Powershell as admin.
2. Than type cd ~/ and later change the path again to the project folder.
3. type python manage.py runserver and press enter.

Vaibhav Vishal's user avatar

answered Aug 10, 2019 at 9:24

AndroidDev Newbie's user avatar

1

had the same problem. fixed it by checking python and django version compatibility. If you’re still battling with this update one or the other or ensure they’re both compatible with each other in the virtual’env’ you’re setting up.

good luck.

answered Jul 27, 2019 at 8:27

benefeela's user avatar

I think you forgot to add python to environment variables. So, During the installation, click the checkbox named «Add Python 3.9 to PATH» to add in environment variables. or you can simply add the path later.
enter image description here

answered Oct 6, 2020 at 6:41

Yumick Gharti's user avatar

Yumick GhartiYumick Gharti

1,0711 gold badge6 silver badges7 bronze badges

When you open the command prompt on windows, the default directory might be C:WINDOWSSystem32>
Here, you have to change the directory by just adding cd to the default directory. Then copy the directory of where your project is and paste with one space. So it will be:
C:yourfolderyourproject>
Next, use the comman which is, python manage.py runserver

That’s all 😅

answered Oct 17, 2022 at 0:13

Mac Joe's user avatar

After setting C:Python in the environment variables, issuing the following command helped:

py manage.py runserver

Krisztián Balla's user avatar

answered Jul 4, 2018 at 7:19

Peter's user avatar

0

Содержание статьи

Python не находит Django
Disallowed host
Не работает runserver
Web application could not be started

You have X unapplied migrations

ERROR: Can not perform a ‘—user’ install

Python не находит Django

(docker) andreyolegovich.ru@server:~/HelloDjango [0] $ python3 manage.py runserver
Traceback (most recent call last):
File «manage.py», line 8, in <module>
from django.core.management import execute_from_command_line

ModuleNotFoundError: No module named ‘django’

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File «manage.py», line 14, in <module>
) from exc
ImportError: Couldn’t import Django. Are you sure it’s installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?

Причина в том, что в PATH не прописан путь до python. Вернитесь к шагу
PATH

Disallowed host

Вы можете запустить Django с помощью

python3 manage.py runserver

И прописали в

settings.py

свои хосты, например так

ALLOWED_HOSTS = ['http://www.andreyolegovich.ru','127.0.0.1','localhost','andreyolegovich.ru','www.andreyolegovich.ru']

Но при обращении к домену в браузере появляется ошибка DisallowedHost

DisallowedHost at /
Invalid HTTP_HOST header: ‘www.andreyolegovich.ru’. You may need to add ‘www.andreyolegovich.ru’ to ALLOWED_HOSTS.
Request Method: GET
Request URL: http://www.andreyolegovich.ru/
Django Version: 2.1.5
Exception Type: DisallowedHost
Exception Value:
Invalid HTTP_HOST header: ‘www.andreyolegovich.ru’. You may need to add ‘www.andreyolegovich.ru’ to ALLOWED_HOSTS.
Exception Location: /home/a/andreyolegovichru/.local/lib/python3.7/site-packages/django/http/request.py in get_host, line 106
Python Executable: /home/a/andreyolegovichru/.local/bin/python3.7
Python Version: 3.7.0
Python Path:
[‘/home/a/andreyolegovichru/andreyolegovich.ru/public_html/HelloDjango’,
‘/home/a/andreyolegovichru/.local/lib/python3.7/site-packages’,
‘/home/a/andreyolegovichru/andreyolegovich.ru’,
‘/opt/passenger40/helper-scripts’,
‘/home/a/andreyolegovichru/.local/lib/python37.zip’,
‘/home/a/andreyolegovichru/.local/lib/python3.7’,
‘/home/a/andreyolegovichru/.local/lib/python3.7/lib-dynload’,
‘/home/a/andreyolegovichru/.local/lib/python3.7/site-packages’]
Server time: Sun, 3 Feb 2019 20:07:57 +0000

Проверьте, всё ли правильно прописали в

settings.py

ALLOWED_HOSTS.

Выключите Django, закройте все консоли подключенные к хостингу или все консоли на локальной машине.

Очистите кэш браузера или откройте url другим браузером.

Не работает runserver Django

Если Вы выполняете команду

python3 manage.py runserver

И ничего не происходит, или например, у Вас работал самый первый проект, а запустить
второй не получается — скорее всего дело в хостинге. На нём может быть закрыта
возможность слушать порты и выбор рабочего проекта происходит с помощью
какого-то скрипта.

Если Вы, как и я, пользуетесь
хостингом beget
, тот этот скипт будет называться

passenger_wsgi.py

и лежать будет на одном уровне с директорией public_html.

Пропишите в нём

os.environ[‘DJANGO_SETTINGS_MODULE’] = ‘Название_нового_прокта.settings’

Web application could not be started

Если Вы хотите переключиться между проектами и уже обновили скрипе passenger_wsgi.py
но получили ошибку

Web application could not be started

Скорее всего Вы забыли пересоздать файл tmp/restart.txt

(docker) andreyolegovich@server:~/andreyolegovich.ru [0] $ touch tmp/restart.txt

Также советую перепроверить не забыли ли Вы поменть системный путь на нужный Вам проект.

При смене проекта обычно нужно делать два изменения в файле passenger_wsgi.py

# -*- coding: utf-8 -*-
import os, sys
sys.path.insert(0, ‘/home/a/andreyolegovich/andreyolegovich.ru/public_html/Project_1’)
#sys.path.insert(0, ‘/home/a/andreyolegovich/andreyolegovich.ru/public_html/Project_2’)
sys.path.insert(1, ‘/home/a/andreyolegovich/.local/lib/python3.7/site-packages’)
os.environ[‘DJANGO_SETTINGS_MODULE’] = ‘Project_1.settings’
#os.environ[‘DJANGO_SETTINGS_MODULE’] = ‘Project_2.settings’
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Ещё одна возможная причина — незаданные переменные в файле

manage.py

You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.

Run ‘python manage.py migrate’ to apply them.

python3 manage.py migrate

ERROR: Can not perform a ‘—user’ install. User site-packages are not visible in this virtualenv.

Если вы пользуетесь виртуальным окружением флаг —user вам скорее всего вообще не нужен.

I am not sure how to fix this issue

I have no idea why I am getting this error when I try to runserver:

Performing system checks...

System check identified no issues (0 silenced).
Unhandled exception in thread started by <function wrapper at 0x1085589b0>
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/django/utils/autoreload.py", line 222, in wrapper
    fn(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 107, in inner_run
    self.check_migrations()
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 159, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File "/Library/Python/2.7/site-packages/django/db/migrations/executor.py", line 17, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/Library/Python/2.7/site-packages/django/db/migrations/loader.py", line 49, in __init__
    self.build_graph()
  File "/Library/Python/2.7/site-packages/django/db/migrations/loader.py", line 184, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "/Library/Python/2.7/site-packages/django/db/migrations/recorder.py", line 59, in applied_migrations
    self.ensure_schema()
  File "/Library/Python/2.7/site-packages/django/db/migrations/recorder.py", line 49, in ensure_schema
    if self.Migration._meta.db_table in self.connection.introspection.get_table_list(self.connection.cursor()):
  File "/Library/Python/2.7/site-packages/django/db/backends/__init__.py", line 165, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/Library/Python/2.7/site-packages/django/db/backends/__init__.py", line 138, in _cursor
    self.ensure_connection()
  File "/Library/Python/2.7/site-packages/django/db/backends/__init__.py", line 133, in ensure_connection
    self.connect()
  File "/Library/Python/2.7/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/Library/Python/2.7/site-packages/django/db/backends/__init__.py", line 133, in ensure_connection
    self.connect()
  File "/Library/Python/2.7/site-packages/django/db/backends/__init__.py", line 122, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/Library/Python/2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 134, in get_new_connection
    return Database.connect(**conn_params)
  File "/Library/Python/2.7/site-packages/psycopg2/__init__.py", line 164, in connect
    conn = _connect(dsn, connection_factory=connection_factory, async=async)
django.db.utils.OperationalError: could not connect to server: Connection refused
        Is the server running on host "127.0.0.1" and accepting
        TCP/IP connections on port 5432?

When I try to connect to postgres:

psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

settings.py:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'beerad',
        'USER': 'bli1',
        'PASSWORD': '',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}

I am not sure how to fix this issue

I have no idea why I am getting this error when I try to runserver:

Performing system checks...

System check identified no issues (0 silenced).
Unhandled exception in thread started by <function wrapper at 0x1085589b0>
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/django/utils/autoreload.py", line 222, in wrapper
    fn(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 107, in inner_run
    self.check_migrations()
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 159, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File "/Library/Python/2.7/site-packages/django/db/migrations/executor.py", line 17, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/Library/Python/2.7/site-packages/django/db/migrations/loader.py", line 49, in __init__
    self.build_graph()
  File "/Library/Python/2.7/site-packages/django/db/migrations/loader.py", line 184, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "/Library/Python/2.7/site-packages/django/db/migrations/recorder.py", line 59, in applied_migrations
    self.ensure_schema()
  File "/Library/Python/2.7/site-packages/django/db/migrations/recorder.py", line 49, in ensure_schema
    if self.Migration._meta.db_table in self.connection.introspection.get_table_list(self.connection.cursor()):
  File "/Library/Python/2.7/site-packages/django/db/backends/__init__.py", line 165, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/Library/Python/2.7/site-packages/django/db/backends/__init__.py", line 138, in _cursor
    self.ensure_connection()
  File "/Library/Python/2.7/site-packages/django/db/backends/__init__.py", line 133, in ensure_connection
    self.connect()
  File "/Library/Python/2.7/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/Library/Python/2.7/site-packages/django/db/backends/__init__.py", line 133, in ensure_connection
    self.connect()
  File "/Library/Python/2.7/site-packages/django/db/backends/__init__.py", line 122, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/Library/Python/2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 134, in get_new_connection
    return Database.connect(**conn_params)
  File "/Library/Python/2.7/site-packages/psycopg2/__init__.py", line 164, in connect
    conn = _connect(dsn, connection_factory=connection_factory, async=async)
django.db.utils.OperationalError: could not connect to server: Connection refused
        Is the server running on host "127.0.0.1" and accepting
        TCP/IP connections on port 5432?

When I try to connect to postgres:

psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

settings.py:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'beerad',
        'USER': 'bli1',
        'PASSWORD': '',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}

Уведомления

  • Начало
  • » Python для новичков
  • » Проблема при запуске сервера Django из проекта PyCharm [Решено]

#1 Авг. 13, 2017 19:30:54

Проблема при запуске сервера Django из проекта PyCharm [Решено]

Привет всем! У меня тут возникла одна проблема при запуске сервера как вы уже поняли из названия темы.
После создания проекта в консоли я написал вот такую команду: python manage.py runserver
Мне выскочила вот такая фигня:

C:UsersАдминистраторPycharmProjectsaudiostock>python manage.py runserver
Performing system checks…

System check identified some issues:

WARNINGS:
?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your def
ault TEMPLATES dict: TEMPLATE_DIRS.

System check identified 1 issue (0 silenced).

You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run ‘python manage.py migrate’ to apply them.
August 13, 2017 — 19:17:44
Django version 1.11.4, using settings ‘audiostock.settings’
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x035BB198>
Traceback (most recent call last):
File “C:Python362libsite-packagesdjangoutilsautoreload.py”, line 228, in wrapper
fn(*args, **kwargs)
File “C:Python362libsite-packagesdjangocoremanagementcommandsrunserver.py”, line 149, in inner_run
ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls)
File “C:Python362libsite-packagesdjangocoreserversbasehttp.py”, line 164, in run
httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
File “C:Python362libsite-packagesdjangocoreserversbasehttp.py”, line 74, in __init__
super(WSGIServer, self).__init__(*args, **kwargs)
File “C:Python362libsocketserver.py”, line 453, in __init__
self.server_bind()
File “C:Python362libwsgirefsimple_server.py”, line 50, in server_bind
HTTPServer.server_bind(self)
File “C:Python362libhttpserver.py”, line 138, in server_bind
self.server_name = socket.getfqdn(host)
File “C:Python362libsocket.py”, line 673, in getfqdn
hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xc4 in position 0: invalid continuation byte

Помогите пожалуйста решить проблему

Отредактировано acadeemic (Авг. 14, 2017 22:47:18)

Офлайн

  • Пожаловаться

#2 Авг. 13, 2017 19:38:36

Проблема при запуске сервера Django из проекта PyCharm [Решено]

acadeemic
C:UsersАдминистратор

У винды стандартные проблемы с кириллицей. Старайтесь никогда не употреблять что-то отличное от основного латинского алфавита в профессиональной деятельности, даже названия файлов и каталогов

Офлайн

  • Пожаловаться

#3 Авг. 13, 2017 19:48:44

Проблема при запуске сервера Django из проекта PyCharm [Решено]

Это мне нужно нового пользователя создать на латинском алфавите?

Офлайн

  • Пожаловаться

#4 Авг. 13, 2017 20:06:27

Проблема при запуске сервера Django из проекта PyCharm [Решено]

Нет все равно проблема не исчезла:

C:UserspythonPycharmProjectsuntitled>python manage.py runserver
Performing system checks…

System check identified some issues:

WARNINGS:
?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your de
fault TEMPLATES dict: TEMPLATE_DIRS.

System check identified 1 issue (0 silenced).

You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run ‘python manage.py migrate’ to apply them.
August 13, 2017 — 20:10:49
Django version 1.11.4, using settings ‘untitled.settings’
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x035BC228>
Traceback (most recent call last):
File “C:Python362libsite-packagesdjangoutilsautoreload.py”, line 228, in wrapper
fn(*args, **kwargs)
File “C:Python362libsite-packagesdjangocoremanagementcommandsrunserver.py”, line 149, in inner_run
ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls)
File “C:Python362libsite-packagesdjangocoreserversbasehttp.py”, line 164, in run
httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
File “C:Python362libsite-packagesdjangocoreserversbasehttp.py”, line 74, in __init__
super(WSGIServer, self).__init__(*args, **kwargs)
File “C:Python362libsocketserver.py”, line 453, in __init__
self.server_bind()
File “C:Python362libwsgirefsimple_server.py”, line 50, in server_bind
HTTPServer.server_bind(self)
File “C:Python362libhttpserver.py”, line 138, in server_bind
self.server_name = socket.getfqdn(host)
File “C:Python362libsocket.py”, line 673, in getfqdn
hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xc4 in position 0: invalid continuation byte

Помогите пожалуйста кто знает что с этим делать.

Отредактировано acadeemic (Авг. 13, 2017 20:14:01)

Офлайн

  • Пожаловаться

#5 Авг. 14, 2017 05:56:06

Проблема при запуске сервера Django из проекта PyCharm [Решено]

acadeemic
Нет все равно проблема не исчезла

А имя компьютера? Его тоже нужно поменять на латинское.

Офлайн

  • Пожаловаться

#6 Авг. 14, 2017 21:00:19

Проблема при запуске сервера Django из проекта PyCharm [Решено]

Спасибо большое, теперь все работает.

Офлайн

  • Пожаловаться

  • Начало
  • » Python для новичков
  • » Проблема при запуске сервера Django из проекта PyCharm [Решено]
Watching for file changes with StatReloader

Exception in thread django-main-thread:

Traceback (most recent call last):

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libthreading.py", line 932, in _bootstrap_inner

self.run()

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libthreading.py", line 870, in run

self._target(*self._args, **self._kwargs)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangoutilsautoreload.py", line 53, in wrapper

fn(*args, **kwargs)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangocoremanagementcommandsrunserver.py", line 109, in inner_run

autoreload.raise_last_exception()

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangoutilsautoreload.py", line 76, in raise_last_exception

raise _exception[1]

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangocoremanagement__init__.py", line 357, in execute

autoreload.check_errors(django.setup)()

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangoutilsautoreload.py", line 53, in wrapper

fn(*args, **kwargs)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjango__init__.py", line 24, in setup

apps.populate(settings.INSTALLED_APPS)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangoappsregistry.py", line 91, in populate

app_config = AppConfig.create(entry)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangoappsconfig.py", line 116, in create

mod = import_module(mod_path)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libimportlib__init__.py", line 127, in import_module

return _bootstrap._gcd_import(name[level], package, level)

File "<frozen importlib._bootstrap>", line 1014, in _gcd_import

File "<frozen importlib._bootstrap>", line 991, in _find_and_load

File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked

File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

File "<frozen importlib._bootstrap>", line 1014, in _gcd_import

File "<frozen importlib._bootstrap>", line 991, in _find_and_load

File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked

ModuleNotFoundError: No module named 'webdjango'

Traceback (most recent call last):

File "manage.py", line 21, in <module>

main()

File "manage.py", line 17, in main

execute_from_command_line(sys.argv)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangocoremanagement__init__.py", line 401, in execute_from_command_line

utility.execute()

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangocoremanagement__init__.py", line 395, in execute

self.fetch_command(subcommand).run_from_argv(self.argv)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangocoremanagementbase.py", line 328, in run_from_argv

self.execute(*args, **cmd_options)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangocoremanagementcommandsrunserver.py", line 60, in execute

super().execute(*args, **options)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangocoremanagementbase.py", line 369, in execute

output = self.handle(*args, **options)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangocoremanagementcommandsrunserver.py", line 95, in handle

self.run(**options)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangocoremanagementcommandsrunserver.py", line 102, in run

autoreload.run_with_reloader(self.inner_run, **options)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangoutilsautoreload.py", line 599, in run_with_reloader

start_django(reloader, main_func, *args, **kwargs)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangoutilsautoreload.py", line 584, in start_django

reloader.run(django_main_thread)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangoutilsautoreload.py", line 299, in run

self.run_loop()

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangoutilsautoreload.py", line 305, in run_loop

next(ticker)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangoutilsautoreload.py", line 345, in tick

for filepath, mtime in self.snapshot_files():

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangoutilsautoreload.py", line 361, in snapshot_files

for file in self.watched_files():

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangoutilsautoreload.py", line 260, in watched_files

yield from iter_all_python_module_files()

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangoutilsautoreload.py", line 105, in iter_all_python_module_files

return iter_modules_and_files(modules, frozenset(_error_files))

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libsite-packagesdjangoutilsautoreload.py", line 141, in iter_modules_and_files

resolved_path = path.resolve(strict=True).absolute()

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libpathlib.py", line 1172, in resolve

s = self._flavour.resolve(self, strict=strict)

File "C:UsersSashaAppDataLocalProgramsPythonPython38-32libpathlib.py", line 200, in resolve

return self._ext_to_normal(_getfinalpathname(s))

OSError: [WinError 123] Синтаксическая ошибка в имени файла, имени папки или метке тома: '<frozen importlib._bootstrap>'

Troubleshooting¶

This page contains some advice about errors and problems commonly encountered
during the development of Django applications.

Problems running django-admin

command not found: django-admin

django-admin should be on your system path if you
installed Django via pip. If it’s not in your path, ensure you have your
virtual environment activated and you can try running the equivalent command
python -m django.

macOS permissions¶

If you’re using macOS, you may see the message “permission denied” when
you try to run django-admin. This is because, on Unix-based systems like
macOS, a file must be marked as “executable” before it can be run as a program.
To do this, open Terminal.app and navigate (using the cd command) to the
directory where django-admin is installed, then
run the command sudo chmod +x django-admin.

Miscellaneous¶

I’m getting a UnicodeDecodeError. What am I doing wrong?¶

This class of errors happen when a bytestring containing non-ASCII sequences is
transformed into a Unicode string and the specified encoding is incorrect. The
output generally looks like this:

UnicodeDecodeError: 'ascii' codec can't decode byte 0x?? in position ?:
ordinal not in range(128)

The resolution mostly depends on the context, however here are two common
pitfalls producing this error:

  • Your system locale may be a default ASCII locale, like the “C” locale on
    UNIX-like systems (can be checked by the locale command). If it’s the
    case, please refer to your system documentation to learn how you can change
    this to a UTF-8 locale.

Related resources:

  • Unicode in Django
  • https://wiki.python.org/moin/UnicodeDecodeError

oleg_357

27 / 2 / 1

Регистрация: 01.06.2017

Сообщений: 80

1

Не запускается сервер от Джанго

07.04.2020, 20:18. Показов 6195. Ответов 9

Метки нет (Все метки)


Вчера от нечего делать попытался запустить сервер от Джанго.
Обратился через Командную строку:

Bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Microsoft Windows [Version 10.0.18362.720]
(c) Корпорация Майкрософт (Microsoft Corporation), 2019. Все права защищены.
C:UsersUser>cd mysite
C:UsersUsermysite>python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
 
System check identified no issues (0 silenced).
April 06, 2020 - 20:43:34
Django version 3.0.5, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[06/Apr/2020 20:44:34] code 400, message Bad request version ('x061¥ðÎgÓÀ²é·æx8bx81D;´¯x02üºgx98x00$x13x01x13x03x13x02À+À/̨̩À,À0À')
[06/Apr/2020 20:44:35] You're accessing the development server over HTTPS, but it only supports HTTP.

Затем набираю для браузера Firefox: https://127.0.0.1:8000/
Он пишет:

Bash
1
2
3
4
5
6
Ошибка при установлении защищённого соединения
При соединении с 127.0.0.1:8000 произошла ошибка. SSL получило запись, длина которой превышает максимально допустимую.
Код ошибки: SSL_ERROR_RX_RECORD_TOO_LONG
    Страница, которую вы пытаетесь просмотреть, не может быть отображена, так как достоверность полученных данных не может быть проверена.
    Пожалуйста, свяжитесь с владельцами веб-сайта и проинформируйте их об этой проблеме.
Подробнее…

Что мне надо сделать? В чем моя ошибка? Как исправить?

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Programming

Эксперт

94731 / 64177 / 26122

Регистрация: 12.04.2006

Сообщений: 116,782

07.04.2020, 20:18

Ответы с готовыми решениями:

Сервер не запускается
После года на складе необходимо запустить сервер. Мать Intel server board SE 7520JR2
При включении…

Не запускается сервер
короче впоследние время вообще нишде не запускается локальный сервер браузер пишет что не может…

Не запускается сервер
начал изучать python+django хотел запустить сервер прописывая в терминале PyCharm &quot;py manage.py…

Не запускается сервер
Привет всем)

Сижу я на symfony 3.2 и вот почему то когда я запускаю локальный сервер в командной…

9

Эксперт Python

683 / 466 / 204

Регистрация: 22.03.2020

Сообщений: 1,051

07.04.2020, 20:24

2

Тут как бы есть соответствующая категория.



0



27 / 2 / 1

Регистрация: 01.06.2017

Сообщений: 80

07.04.2020, 20:30

 [ТС]

3

Цитата
Сообщение от unfindable_404
Посмотреть сообщение

как бы есть соответствующая категория

Я видел тот раздел для Django, там народу мало, редко кто бывает.
А мне как новичку любые советы интересны, поэтому обратился сюда.



0



Эксперт Python

5403 / 3827 / 1214

Регистрация: 28.10.2013

Сообщений: 9,554

Записей в блоге: 1

07.04.2020, 20:37

4

Лучший ответ Сообщение было отмечено oleg_357 как решение

Решение

Цитата
Сообщение от oleg_357
Посмотреть сообщение

Затем набираю для браузера Firefox: https://127.0.0.1:8000/

Убери эту буковку.
И в следующий раз попробуй читать отладочные сообщения: You’re accessing the development server over HTTPS, but it only supports HTTP.



1



Эксперт Python

683 / 466 / 204

Регистрация: 22.03.2020

Сообщений: 1,051

07.04.2020, 20:38

5

Ну у вас явно проблема с SSL сертификатом. У вас он вообще есть?



0



Эксперт Python

5403 / 3827 / 1214

Регистрация: 28.10.2013

Сообщений: 9,554

Записей в блоге: 1

07.04.2020, 20:38

6

del



0



27 / 2 / 1

Регистрация: 01.06.2017

Сообщений: 80

07.04.2020, 21:10

 [ТС]

7

Цитата
Сообщение от Garry Galler
Посмотреть сообщение

Убери эту буковку

Убрал: http://127.0.0.1:8000/
Спасибо! сервер появился.

Добавлено через 1 минуту

Цитата
Сообщение от unfindable_404
Посмотреть сообщение

проблема с SSL сертификатом. У вас он вообще есть?

Откуда? Я даже не знаю что это такое, первый раз слышу.



0



Эксперт Python

683 / 466 / 204

Регистрация: 22.03.2020

Сообщений: 1,051

07.04.2020, 22:33

8

Цитата
Сообщение от oleg_357
Посмотреть сообщение

Откуда? Я даже не знаю что это такое, первый раз слышу.

Это как раз тот сертификат, который позволит сайту работать по протоколу https)))



0



27 / 2 / 1

Регистрация: 01.06.2017

Сообщений: 80

08.04.2020, 20:24

 [ТС]

9

Цитата
Сообщение от unfindable_404
Посмотреть сообщение

тот сертификат, который позволит сайту работать по протоколу https

Что надо сделать для этого? Как его быстро получить, в смысле сертификат?



0



Эксперт Python

683 / 466 / 204

Регистрация: 22.03.2020

Сообщений: 1,051

08.04.2020, 22:35

10

Цитата
Сообщение от oleg_357
Посмотреть сообщение

Как его быстро получить, в смысле сертификат?

ТУТ описан способ.



1



IT_Exp

Эксперт

87844 / 49110 / 22898

Регистрация: 17.06.2006

Сообщений: 92,604

08.04.2020, 22:35

10

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Ошибка при запуске службы агент сервера 1с при установке
  • Ошибка при запуске сервера dayz