# relative import with no known parent package

**URL:** https://forum.djangoproject.com/t/relative-import-with-no-known-parent-package/8271
**Category:** Using Django
**Created:** [June 9, 2021, 2:48am UTC](https://forum.djangoproject.com/t/relative-import-with-no-known-parent-package/8271 "2021-06-09T02:48:20Z")
**Posts on this page:** 1
**Showing post:** 8

<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: [June 9, 2021, 6:21pm UTC](https://forum.djangoproject.com/t/relative-import-with-no-known-parent-package/8271/8 "2021-06-09T18:21:58Z")

</div>

> [@thelpend](#):
>
> Yes, it’s exactly what i’m trying to do.

So when you run this for the 10th time, you want 10 copies of that _same_ data in the database? If you’re doing it with 100 users, you want 1000 entries in your database? These entries don’t go away when the app ends.

The way you’re designing this, you’re going to have n \* m rows in the database, where n is the number of users and m is the number of times you’ve started your app.

> [@thelpend](#):
>
> what is the correct way to do it?

If you haven’t yet worked your way through the [Official Django Tutorial](https://docs.djangoproject.com/en/3.2/intro/tutorial01/), that’s the best place to start. If you have completed that, then…

> [@KenWhitesell](#):
>
> You either want to create a fixture file that can be loaded one time using the `manage.py loaddata` , or you might want to create a custom django-admin command.

See [Providing initial data for models | Django documentation | Django](https://docs.djangoproject.com/en/3.2/howto/initial-data/#providing-initial-data-for-models) and [Writing custom django-admin commands | Django documentation | Django](https://docs.djangoproject.com/en/3.2/howto/custom-management-commands/)

What you don’t want to do is have this type of code run automatically with each start.

You also need to be aware that when you’re running Django, your “current directory” is _not_ the directory for each file being run - it’s the directory where you’re running manage.py. Relative imports are relative to _that_ location, not the location of the function currently being executed.

---

_[View the full topic](https://forum.djangoproject.com/t/relative-import-with-no-known-parent-package/8271)._
