# Django tutorial: \`python manage.py startapp polls\` fails

**URL:** <https://forum.djangoproject.com/t/django-tutorial-python-manage-py-startapp-polls-fails/2718>\
**Category:** Getting Started\
**Created:** [May 31, 2020, 11:39pm UTC](https://forum.djangoproject.com/t/django-tutorial-python-manage-py-startapp-polls-fails/2718 "2020-05-31T23:39:44Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![bryanmobrien](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/bryanmobrien/32/1301_2.png) [@bryanmobrien](https://forum.djangoproject.com/u/bryanmobrien)\
**Post date:** [May 31, 2020, 11:39pm UTC](https://forum.djangoproject.com/t/django-tutorial-python-manage-py-startapp-polls-fails/2718/1 "2020-05-31T23:39:44Z")

</div>

Trying the official tutorial, using Catalina 10.15.5, python 3.8.3 and django 3.0.6, is failing with:

```
TypeError: argument of type 'PosixPath' is not iterable

```

Absolute beginner with Django, couldn’t find much help with searches.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 31, 2020, 11:56pm UTC](https://forum.djangoproject.com/t/django-tutorial-python-manage-py-startapp-polls-fails/2718/2 "2020-05-31T23:56:00Z")

</div>

Where at within the official tutorial are you receiving this message?  
(What command is generating this message and what step are you on?)

---

<div class="post-metadata">

**Author:** ![bryanmobrien](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/bryanmobrien/32/1301_2.png) [@bryanmobrien](https://forum.djangoproject.com/u/bryanmobrien)\
**Post date:** [June 1, 2020, 12:21am UTC](https://forum.djangoproject.com/t/django-tutorial-python-manage-py-startapp-polls-fails/2718/3 "2020-06-01T00:21:26Z")

</div>

From [here](https://docs.djangoproject.com/en/3.0/intro/tutorial01/), everything was successful until I got to [this section](https://docs.djangoproject.com/en/3.0/intro/tutorial01/#creating-the-polls-app).

The traceback is:  
Traceback (most recent call last):

> File “manage.py”, line 22, in   
> main()  
> File “manage.py”, line 18, in main  
> execute\_from\_command\_line(sys.argv)  
> File “/Users/bobrien/.pyenv/versions/django-realpython.com/lib/python3.8/site-packages/django/core/management/ **init**.py”, line 401, in execute\_from\_command\_line  
> utility.execute()  
> File “/Users/bobrien/.pyenv/versions/django-realpython.com/lib/python3.8/site-packages/django/core/management/ **init**.py”, line 395, in execute  
> self.fetch\_command(subcommand).run\_from\_argv(self.argv)  
> File “/Users/bobrien/.pyenv/versions/django-realpython.com/lib/python3.8/site-packages/django/core/management/base.py”, line 341, in run\_from\_argv  
> connections.close\_all()  
> File “/Users/bobrien/.pyenv/versions/django-realpython.com/lib/python3.8/site-packages/django/db/utils.py”, line 230, in close\_all  
> connection.close()  
> File “/Users/bobrien/.pyenv/versions/django-realpython.com/lib/python3.8/site-packages/django/utils/asyncio.py”, line 26, in inner  
> return func(\*args, \*\*kwargs)  
> File “/Users/bobrien/.pyenv/versions/django-realpython.com/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py”, line 261, in close  
> if not self.is\_in\_memory\_db():  
> File “/Users/bobrien/.pyenv/versions/django-realpython.com/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py”, line 380, in is\_in\_memory\_db  
> return self.creation.is\_in\_memory\_db(self.settings\_dict[‘NAME’])  
> File “/Users/bobrien/.pyenv/versions/django-realpython.com/lib/python3.8/site-packages/django/db/backends/sqlite3/creation.py”, line 12, in is\_in\_memory\_db  
> return database\_name == ‘:memory:’ or ‘mode=memory’ in database\_name  
> TypeError: argument of type ‘PosixPath’ is not iterable

---

<div class="post-metadata">

**Author:** ![adamchainz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adamchainz/32/26_2.png) [@adamchainz](https://forum.djangoproject.com/u/adamchainz)\
**Post date:** [June 1, 2020, 5:14am UTC](https://forum.djangoproject.com/t/django-tutorial-python-manage-py-startapp-polls-fails/2718/4 "2020-06-01T05:14:24Z")

</div>

I think you’ve somehow used Django 3.1’s startproject template. Django 3.1 moved the `BASE_DIR` pseudo-setting to use `pathlib.Path` rather than a plain string. Support for this needed adding to some places like the sqlite driver, so it doesn’t work there.

If you look at the definition of `BASE_DIR` in your settings file, is it using a `Path()` ? If so you can use `str()` around its use in your `DATABASES` setting, i.e. `str(BASE_DIR / "something.sqlite")`.

I covered this change more in a blog post: [Use Pathlib in Your Django Settings File](https://adamj.eu/tech/2020/03/16/use-pathlib-in-your-django-project/)

Hope that helps

---

<div class="post-metadata">

**Author:** ![bryanmobrien](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/bryanmobrien/32/1301_2.png) [@bryanmobrien](https://forum.djangoproject.com/u/bryanmobrien)\
**Post date:** [June 1, 2020, 2:56pm UTC](https://forum.djangoproject.com/t/django-tutorial-python-manage-py-startapp-polls-fails/2718/5 "2020-06-01T14:56:56Z")

</div>

@adamchainz @KenWhitesell  
Thank you **both** for your help.  
I deactivated my virtualenv and got past this error.  
Now, I’m into the actual polls app - and can see both /polls and /admin, but getting a 404 when I try to access [http://127.0.0.1:8000](http://127.0.0.1:8000)😂

Please note: I’m not asking for help on my new issue in this thread. I’ll open a new topic if I can’t figure this one out.

Again, thank you from a Django beginner!

---

<div class="post-metadata">

**Author:** ![adamchainz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adamchainz/32/26_2.png) [@adamchainz](https://forum.djangoproject.com/u/adamchainz)\
**Post date:** [June 1, 2020, 4:02pm UTC](https://forum.djangoproject.com/t/django-tutorial-python-manage-py-startapp-polls-fails/2718/6 "2020-06-01T16:02:49Z")

</div>

@bryanmobrien that’s expected. There is no URL mapped at the root, only the index at `polls/` and the admin at `admin/`, so you should see Django’s yellow debug 404 page when visiting the root URL.

---

<div class="post-metadata">

**Author:** ![bryanmobrien](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/bryanmobrien/32/1301_2.png) [@bryanmobrien](https://forum.djangoproject.com/u/bryanmobrien)\
**Post date:** [June 1, 2020, 5:04pm UTC](https://forum.djangoproject.com/t/django-tutorial-python-manage-py-startapp-polls-fails/2718/7 "2020-06-01T17:04:41Z")

</div>

Thank you! I assumed I fat-fingered urls.py or settings.  
Moving forward! 🤪

---

<div class="post-metadata">

**Author:** ![aydencraig23](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@aydencraig23](https://forum.djangoproject.com/u/aydencraig23)\
**Post date:** [October 9, 2020, 3:40pm UTC](https://forum.djangoproject.com/t/django-tutorial-python-manage-py-startapp-polls-fails/2718/8 "2020-10-09T15:40:53Z")

</div>

I had the same problem as the original poster and your solution worked! Thanks for your help

---

<div class="post-metadata">

**Author:** ![DrGabrielCodes](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/drgabrielcodes/32/7577_2.png) [@DrGabrielCodes](https://forum.djangoproject.com/u/DrGabrielCodes)\
**Post date:** [February 23, 2022, 3:53pm UTC](https://forum.djangoproject.com/t/django-tutorial-python-manage-py-startapp-polls-fails/2718/9 "2022-02-23T15:53:21Z")

</div>

Thanks a lot. Your suggestion was really helpful to solve this problem I also ran into.

---

<div class="post-metadata">

**Author:** ![sekmani](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/sekmani/32/9287_2.png) [@sekmani](https://forum.djangoproject.com/u/sekmani)\
**Post date:** [July 15, 2022, 10:51pm UTC](https://forum.djangoproject.com/t/django-tutorial-python-manage-py-startapp-polls-fails/2718/10 "2022-07-15T22:51:47Z")

</div>

Your solution solve my problem thanks, but just I want to inform that this change need to be in the settings.py file  
the path: /your\_project/src/mysite
