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

  • Home
  • SEARCH
  • 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 6559533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:20:23+00:00 2026-05-25T13:20:23+00:00

I am new to Django and Python. I have created a python file in

  • 0

I am new to Django and Python.

I have created a python file in my application root called services.py. Inside this file I have a class named SchedulerService. I am trying to initialize an instance of SchedulerService in the settings module so it will be available every time a view is executed. In the Java world I would use a singleton object and initialize it with an auto init servlet or a MBean.

The problem I am running into is that I cannot import any custom modules into the settings.py file. For instance:

settings.py

from theapp.services import SchedulerService

I get the following message when I attempt to start my development server

Error: Can't find the file 'settings.py' in the directory containing 'manage.py'. It appears you've customized things.
You'll have to run django-admin.py, passing it your settings module.
(If the file settings.py does indeed exist, it's causing an ImportError somehow.)

I get the same error if I try to import a view or model class into the settings module.

Perhaps I am going about it entirely wrong and should be implementing this in another manner.

Any help will be appreciated.

  • 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-25T13:20:24+00:00Added an answer on May 25, 2026 at 1:20 pm

    That particular message is characteristic of a circular import issue – theapp.services probably imports settings, or imports something which in turn imports settings, and Python can’t resolve the dependency.

    You could probably resolve this by moving one of the imports into a function or method, but I should say that settings.py is emphatically not the place to be instantiating things. It really, really isn’t meant for that.

    I hope that due to your reference to a “global” object, you’ve already considered thread-safety issues: dont’ forget, Django processes are not created and destroyed for each request, one process can serve multiple requests before being destroyed, so any global objects will be shared between those requests. If that’s not what you want, you’ll need to instantiate the object within the request cycle itself, perhaps in middleware, and associate it with an object that only lasts the lifetime of the request – in other words, probably the request object itself.

    Otherwise, you could do something similar to the admin application, and put your instantiation call in urls.py.

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

Sidebar

Related Questions

I have new to python and django I am creating poll application and in
I'm new to Django. I have created a new App called Directorio and now
Apologies, I am completely new to Django and Python. I have 2 questions. First,
I a new to django and python. I have however managed to build a
I have a new Django 1.3 project and app that I've created. I added
I have created a django app. Now i want to test the application's performance
I have a web report that uses a Django form (new forms) for fields
New to xml. Looking for XPath to search a xml file with python ElementTree
I am new to django and python in general, so pardon me for any
I'm somewhat new to Python, Django, and I'd like some advice on how to

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.