Idan
Idan

Reputation: 11

Error in runserver with Django on windows 10

I am using python 3.5 and windows 10, but had the same issue using windows 8, and that is the traceback i get while trying to runserver:

Traceback (most recent call last): File "C:\Users\noabendor87\documents\otree\manage.py", line 10, in execute_from_command_line(sys.argv, script_file=file) File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\otree\management\cli.py", line 177, in execute_from_command_line utility.execute() File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management__init__ .py", line 346, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\base.py" , line 394, in run_from_argv self.execute(*args, **cmd_options) File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\commands \runserver.py", line 49, in execute super(Command, self).execute(*args, **options) File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\base.py" , line 445, in execute output = self.handle(*args, **options) File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\commands \runserver.py", line 88, in handle self.run(**options) File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\core\management\commands \runserver.py", line 97, in run autoreload.main(self.inner_run, None, options) File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\utils\autoreload.py", li ne 336, in main reloader(wrapped_main_func, args, kwargs) File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\utils\autoreload.py", li ne 307, in python_reloader exit_code = restart_with_reloader() File "c:\users\noabendor87\appdata\local\programs\python\python35-32\lib\site-packages\django\utils\autoreload.py", li ne 293, in restart_with_reloader exit_code = os.spawnve(os.P_WAIT, sys.executable, args, new_environ) UnicodeEncodeError: 'mbcs' codec can't encode characters in position 0--1: invalid character

I have already tried following the instructions in the following link: http://stackoverflow.com/questions/25714826/error-in-manage-py-runserver-with-django-on-windows-8-1

but it did not help.

This is how the lines of code look like:

enter image description here

(Since Im a new user I cannot paste the image to the original post)

Anyone have encountered something similar and have a solution?

Upvotes: 1

Views: 898

Answers (2)

Tech Voltage
Tech Voltage

Reputation: 37

first I will like you check the django version you are working with my "type python -m django --version" or "pip freeze". check weather its compatible with the python version on your pc. if it's not install compatible python version. then check weather "init.py" is within your project directory, if not add it to your project directory. then run "Set-ExecutionPolicy -Scope CurrentUser Unrestricted" on your terminal. then run activate your virtualenv, then run "python manage.py runserver"

Upvotes: 0

oosthuizenb
oosthuizenb

Reputation: 116

I used to have similar problems because of the difficulties with the virtual environment in windows 10. Try running the powershell as an administrator and do "Set-ExecutionPolicy RemoteSigned" or "Set-ExecutionPolicy Unrestricted" if remotesigned does not work. Do this before activating the virtualenv.

Upvotes: 0

Related Questions