Hubble
Hubble

Reputation: 5

Import whole module to Python/Django project

I need to import whole custom module (config.py) to settings.py file. Both on the same folder.

Folder structure

It works fine when I use from .config import var

BUT

import config or import .config gives no module or invalid syntax error.

Is there way to import whole module to Django files?

Upvotes: 0

Views: 111

Answers (1)

9769953
9769953

Reputation: 12241

Use

from . import config

for a relative import of the whole module.

Upvotes: 2

Related Questions