Project directory management

20 views
Skip to first unread message

Devender Kumar

unread,
Feb 28, 2020, 6:08:15 AM2/28/20
to Django users
Hi,
BTW it is flask app question.

dir structure 
 service 
     config/__init__.py
    config/config.py
    src/app.py
    src/__init__.py

Running the flask app by writing command python src/app.py

Question: I want to access config parameter in flask app from config module of config package how can do that. 

solutions I tried write sys.path.append(''../")  to my src/__init__.py file but its not working please help me write this right way.

seems src/__init__.py is not being called.

I don't want to change my dir structure and I don't want to write sys.path.append(''../") in my app.py file, 

Thanks in advance 

Andréas Kühne

unread,
Feb 28, 2020, 6:53:08 AM2/28/20
to django...@googlegroups.com
If it is a flask app question, you should ask it on a flask mailing list. You will probably get better responses :-)

Regards,

Andréas


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5b1e9a97-bede-4454-8b32-9d477fe4d954%40googlegroups.com.

Agoua David

unread,
Feb 28, 2020, 7:34:16 AM2/28/20
to django...@googlegroups.com
Since the flask app config is a singleton, I think you can just call it in your config/config.py module by import src/app.py if src is a package

Naveen Arora

unread,
Feb 28, 2020, 7:36:48 AM2/28/20
to Django users
Hi,

from .. import abc is not working ?
or somewhat like that.

At last sys.path.append() is one of the solutions.

Cheers,
Naveen Arora
Reply all
Reply to author
Forward
0 new messages