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 8340615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:13:43+00:00 2026-06-09T05:13:43+00:00

On the production server I would like to sync the db. If I just

  • 0

On the production server I would like to sync the db.

If I just did that

django-admin.py syncdb it would pick the settings.py. But I have an extra settings-production.py that inheritcs from settings.

Hence I came up with this:

django-admin.py syncdb --settings=/path/to/settings_production

ImportError: Could not import settings
‘/path/to/settings_production’ (Is it on
sys.path?): Import by filename is not supported.

I googled and found someone had a similar issue here. However something that confuses me is, the WSGI.py is only read by Apache. Not if I ran the command myself. The answer there doesn’t really make sense to me.

How do I add my production_settings in sys.path manually to run syncdb?
Many Thanks,

  • 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-06-09T05:13:45+00:00Added an answer on June 9, 2026 at 5:13 am

    First make sure settings_production.py is in the same directory as settings.py.

    Since you are inheriting from settings you can add at the bottom of settings.py:

    try:
       from settings_production import *
    except ImportError:
       pass
    

    If you want to only use settings_production.py make sure it has all the settings for your application (database, et. al.) then:

    DJANGO_SETTINGS_MODULE=settings_production python manage.py syncdb

    Edit

    I was going to post it as a comment, but it became too long:

    I did it this way because typically in production one only changes a few values you can import in the master settings.py; and the last value of the variable is used (so if you set production db in settings_production.py, then that setting is used).

    It is easier this way since django by default will look for settings.py; avoids having to deal with environment variables and import paths especially if you are changing minor things.

    There are a few draw backs to this approach; for example I can’t imagine its very portable especially if you have multiple environments (staging/testing/production/dev), as then you have multiple from _foo_ import * statements and it can lead to problems because the order of imports becomes significant; if you forgot and kept around a stray settings_*.py around – for example the test environment also got the dev file because some developer forgot to remove it from the test branch.

    For more complex setups its easier to keep complete copies of the master settings.py file; and then point DJANGO_SETTINGS_MODULE to the python path of those files. The caveat here is that you have to make sure PYTHONPATH is adjusted to include the location of your settings.

    For more ideas, see the SplitSettings wiki entry.

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

Sidebar

Related Questions

I have a git bare repo on production server: /home/username/railsapp.git Now I would like
I have a simple MVC application that sometimes fails in production. I would like
For performance testing, I would like to capture some traffic from a production server
Having properly configured a Development server and a Production server, I would like to
I would like the ability to have a test ClickOnce server for my applications
I have a production server running an app that uses CouchDB as its main
When I ssh into a remote production server I would like the colour scheme
I have a backup server that replicates my production server's mysql database, awhile ago
We have Windows Server 2008 as our Production server hosted in RackSpace environment. Following
I am using Sqlite on a production server but getting into deadlock scenarios. I

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.