Reputation: 69
i have a project in django named x and i have an app name y in x. in the directry of y i have my views and i write a function in one script named project that is wrapped into two other directories named dir1 and dir2 that dir1 is placed in y directory how to to access my function i tried:
from dir1.dir2 import project
and
from .dir1.dir2 import project
and
from dir1.dir2.project import *
and
from .dir1.dir2.project import *
my directory is like this:
x
x
y
views.py
dir1
dir2
project
i have other libraries in dir2 and when i take the files and insert into y directory and then i use from project import * it works correctly.
and i had a project named b and i renamed it to x is it possible to related this.
how can i fix this
Upvotes: 0
Views: 107
Reputation: 69
I should create
__init__.py
in each directory I that I created.
Upvotes: 0