#28174: Cannot run `manage.py runserver` on Windows with quotation mark in .env
file (TypeError: environment can only contain strings)
-------------------------------------+-------------------------------------
Reporter: Paul | Owner: nobody
Mestemaker |
Type: Bug | Status: new
Component: Core | Version: 1.11
(Management commands) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
We have a .env file with a SECRET_KEY defined as follows
SECRET_KEY="SECRETKEYHERE"
This causes a failure with Django 1.11. The workarounds are:
1) Downgrade to Django 1.10
2) Remove the quotation marks and just have SECRET_KEY=SECRETKEYHERE
This appears to only be a problem on Windows and does not repro on
Mac/Linux.
{{{
(tmadashboard) c:\development\workspaces\tma\dashboard\dashboard>pip
install django==1.10 --upgrade
Collecting django==1.10
Downloading Django-1.10-py2.py3-none-any.whl (6.8MB)
100% |################################| 6.8MB 124kB/s
Installing collected packages: django
Found existing installation: Django 1.11
Uninstalling Django-1.11:
Successfully uninstalled Django-1.11
Successfully installed django-1.10
(tmadashboard) c:\development\workspaces\tma\dashboard\dashboard>python
manage.py runserver
Performing system checks...
RUNNING IN DEVELOPMENT MODE. ADDING STATIC FILE DIRECTORIES TO SERVE
System check identified no issues (0 silenced).
May 04, 2017 - 12:46:16
Django version 1.10, using settings 'dashboard.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
(tmadashboard) c:\development\workspaces\tma\dashboard\dashboard>pip
install --upgrade django
Collecting django
Using cached Django-1.11-py2.py3-none-any.whl
Requirement already up-to-date: pytz in
c:\development\python\python2712\virtualenvs\tmadashboard\lib\site-
packages (from django)
Installing collected packages: django
Found existing installation: Django 1.10
Uninstalling Django-1.10:
Successfully uninstalled Django-1.10
Successfully installed django-1.11
(tmadashboard) c:\development\workspaces\tma\dashboard\dashboard>python
manage.py runserver
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "c:\development\python\Python2712\virtualenvs\tmadashboard\lib
\site-packages\django\core\management\__init__.py", line 363, in
execute_from_command_line
utility.execute()
File "c:\development\python\Python2712\virtualenvs\tmadashboard\lib
\site-packages\django\core\management\__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "c:\development\python\Python2712\virtualenvs\tmadashboard\lib
\site-packages\django\core\management\base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "c:\development\python\Python2712\virtualenvs\tmadashboard\lib
\site-packages\django\core\management\commands\runserver.py", line 62, in
execute
super(Command, self).execute(*args, **options)
File "c:\development\python\Python2712\virtualenvs\tmadashboard\lib
\site-packages\django\core\management\base.py", line 330, in execute
output = self.handle(*args, **options)
File "c:\development\python\Python2712\virtualenvs\tmadashboard\lib
\site-packages\django\core\management\commands\runserver.py", line 101, in
handle
self.run(**options)
File "c:\development\python\Python2712\virtualenvs\tmadashboard\lib
\site-packages\django\core\management\commands\runserver.py", line 110, in
run
autoreload.main(self.inner_run, None, options)
File "c:\development\python\Python2712\virtualenvs\tmadashboard\lib
\site-packages\django\utils\autoreload.py", line 332, in main
reloader(wrapped_main_func, args, kwargs)
File "c:\development\python\Python2712\virtualenvs\tmadashboard\lib
\site-packages\django\utils\autoreload.py", line 303, in python_reloader
exit_code = restart_with_reloader()
File "c:\development\python\Python2712\virtualenvs\tmadashboard\lib
\site-packages\django\utils\autoreload.py", line 289, in
restart_with_reloader
exit_code = subprocess.call(args, env=new_environ)
File "c:\development\python\python2712\Lib\subprocess.py", line 523, in
call
return Popen(*popenargs, **kwargs).wait()
File "c:\development\python\python2712\Lib\subprocess.py", line 711, in
__init__
errread, errwrite)
File "c:\development\python\python2712\Lib\subprocess.py", line 959, in
_execute_child
startupinfo)
TypeError: environment can only contain strings
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28174>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.3f3eb98cb34c9ea5bb0783d7946ea482%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.