Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 615217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:11:46+00:00 2026-05-13T18:11:46+00:00

I am building a web app with this directory structure: app/ __init__.py config/ __init__.py

  • 0

I am building a web app with this directory structure:

app/
    __init__.py
    config/
        __init__.py
        db_config.py
    models/
        __init__.py
        model.py
        datasources/
            __init__.py
            database.py
    ...
    ...

Every __init__.py file has

__all__ = ['', '', ...]

in it, listing the .py files that are in the same directory as it. So, app/__init__.py is empty, app/config/__init__.py has

__all__ = ['db_config']

, etc. in app/models/datasources/database.py, I cannot seem to import anything from app/config/db_config.py. I have tried

import app.config.db_config
import config.db_config
from app.config.db_config import *

but none of them has worked. If anyone has any ideas I’d really appreciate hearing them.

Also, I apologize if this is a duplicate question, but I wasn’t sure exactly what to search for.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:11:46+00:00Added an answer on May 13, 2026 at 6:11 pm

    import app.config.db_config is the best way (avoid non-absolute imports and never ever use import *), and for this to work the app directory should be in sys.path. If it is not, add the directory to you PYTHONPATH or move the project to somewhere this is the case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 507k
  • Answers 507k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In my application there is a custom exception (extending RuntimeException)… May 16, 2026 at 4:09 pm
  • Editorial Team
    Editorial Team added an answer That sounds like homework, so I'll put the answer on… May 16, 2026 at 4:09 pm
  • Editorial Team
    Editorial Team added an answer Looks to me like you're trying to your dependency properties… May 16, 2026 at 4:09 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm building a small personal web app in Ruby on Rails. I've set it
I'm building a JSF+Facelets web app, one piece of which is a method that
I'm building a Spring web app and up until now all of my testing
I'm writing a web app which is used a SaS. Each customer has their
I'm building a small web application with ASP.NET MVC 2, using db4o as a
I'm building an app using Windows Azure Table. I've encapsulated all my calls to
I'm building an android app and I'm currently having trouble retrieving a bitmap from
I'm trying to develop my first web application using Web.Config transformations. Trying to run
I'm building a simple application. It's a user interface to an online order system.
I know this in general is beyond the scope of SO, but I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.