python error AttributeError: 'str' object has no attribute 'setdefault'
<p>I'm trying to run the django project using this command.</p>

<pre><code>python manage.py runserver 8080
</code></pre>

<p>But everytime I'm trying to run I faced the such a error.</p>

<pre><code>Traceback (most recent call last):
File "manage.py", line 10, in &lt;module&gt;
execute_from_command_line(sys.argv)
File "/Users/admin/.virtualenvs/myprojectname/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/Users/admin/.virtualenvs/myprojectname/lib/python2.7/site-packages/django/core/management/__init__.py", line 327, in execute
django.setup()
File "/Users/admin/.virtualenvs/myprojectname/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/admin/.virtualenvs/myprojectname/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/Users/admin/.virtualenvs/myprojectname/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in    import_module
__import__(name)
File "/Users/admin/.virtualenvs/myprojectname/lib/python2.7/site-packages/django/contrib/auth/models.py", line 4, in &lt;module&gt;
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/Users/admin/.virtualenvs/myprojectname/lib/python2.7/site-packages/django/contrib/auth/base_user.py", line 49, in &lt;module&gt;
class AbstractBaseUser(models.Model):
File "/Users/admin/.virtualenvs/myprojectname/lib/python2.7/site-packages/django/db/models/base.py", line 108, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/Users/admin/.virtualenvs/myprojectname/lib/python2.7/site-packages/django/db/models/base.py", line 307, in add_to_class
value.contribute_to_class(cls, name)
File "/Users/admin/.virtualenvs/myprojectname/lib/python2.7/site-packages/django/db/models/options.py", line 263, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/Users/admin/.virtualenvs/myprojectname/lib/python2.7/site-packages/django/db/__init__.py", line 36, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Users/admin/.virtualenvs/myprojectname/lib/python2.7/site-packages/django/db/utils.py", line 209, in __getitem__
self.ensure_defaults(alias)
File "/Users/admin/.virtualenvs/myprojectname/lib/python2.7/site-packages/django/db/utils.py", line 181, in ensure_defaults
conn.setdefault('ATOMIC_REQUESTS', False)

AttributeError: 'str' object has no attribute 'setdefault'
</code></pre>

<p>I tried python2(python2.7.11) and python3(python3.5.1) with virtualenvwrapper. 
I think it's not the bug of the project source. but something missed in environment configuration.
But I can't figure out what the problem is.
Please help me fix it. </p>

<p>Thanks in advance.</p>

<p>It's better if you show us your settings.py to check if it is ok. </p>

<p>Remember to use python3 instead of python. Sometimes I got strange errors for this reason.  </p>

<p>python3 manage.py runserver 8080</p>

python django