4

I have a problem when trying to create migrations. manage.py behave in a very weird way - it takes arguments which are given for schemamigration and answers that I provided non-existing option.

When I run

# ../manage.py schemamigration locations --initial

I get

Usage: manage.py [options]

manage.py: error: no such option: --initial

EDIT: I get the same problem, when I pass any argument to any manage.py command for example

../manage.py runserver --settings=app.settings

I have done the same many times before and I have never had any problem like this. It has worked on my local server and when I was trying to configure remote server, I had got this problem.

My manage.py file looks like this:

#!/usr/bin/env python
import os
import sys

def isProduction():
    import socket
    if socket.gethostname().startswith('ip'):
        return True
    return False

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")
    if isProduction():
        os.environ.setdefault('DJANGO_CONFIGURATION', 'ProdSettings')
    else:
        os.environ.setdefault('DJANGO_CONFIGURATION', 'DevSettings')

    from configurations.management import execute_from_command_line

    execute_from_command_line(sys.argv)

I use django-configurations, but it should not cause any problems(It has worked a few times before). I think the problem is somewhere else. Any ideas what can cause such a weird problem?

lukaszzenko
  • 317
  • 4
  • 11
  • have you tried `../manage.py schemamigration locations --auto` – catherine Mar 31 '13 at 11:25
  • Yes, I get the same output message. but this problem is not related to schemamigration, it is related to manage.py. this problem occur to every option starting with -- – lukaszzenko Mar 31 '13 at 11:52
  • OK change `app` into `project_name` `manage.py runserver --settings=project_name.settings` or if not working try this one: `manage.py runserver --settings=settings` – catherine Mar 31 '13 at 12:20
  • make sure you are in the same directory as manage.py, as south uses relative paths. – karthikr Mar 31 '13 at 15:07
  • The problem is NOT related to south nor to the arguments I pass to manage.py. WHATEVER argument I pass to manage.py I get a message manage.py: error: no such option: ... So, for example, when I run 'manage.py runserver' everything works gracefully, but when I run 'manage.py runserver --settings=whatever' I get an error 'manage.py: error: no such option: --settings' – lukaszzenko Mar 31 '13 at 15:44

2 Answers2

1

I don't know why but it turned out the problem was in using django-configurations in version 0.2.

Switching with Django to 1.4.2 and with django-configurations to 0.1 solved this problem.

lukaszzenko
  • 317
  • 4
  • 11
0

I've attempted a fix for this. See the Github issue, https://github.com/jezdez/django-configurations/issues/21

Rolo
  • 6,070
  • 1
  • 21
  • 12