Closed dpmontero closed 7 years ago
Can you post the full traceback please?
I'm currently trying to reproduce this. What database are you using (MySQL variant, PostgreSQL, SQLite, etc.)?
What tables currently exist in the database? Does your django_migrations
table include any migrations for the cities
app?
I tweaked the migrations in the last commit - can you test the current HEAD in master? You can also just copy/paste the current cities/migrations/0002_continent_models_and_foreign_keys.py
into the installed cities
module in your virtualenv and try to run migrations again.
I solved!
The problem was I had rows cities
in the table django_migrations
column app
, I deleted and I can to continue!.
Also I changed the database engine for postgis
I had postgresql_psycopg2:
DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis',
The next problem was my initial issue #127 what not reconized the command --import=all
in Django v1.10. You can commit the change (I do not control the version of Django) your 'cities.py'. My solution:
.
.
.
class Command(BaseCommand):
if hasattr(settings, 'data_dir'):
data_dir = settings.data_dir
else:
app_dir = os.path.normpath(os.path.dirname(os.path.realpath(__file__)) + '/../..')
data_dir = os.path.join(app_dir, 'data')
logger = logging.getLogger(LOGGER_NAME)
def add_arguments(self, parser):
parser.add_argument(
'--force',
action='store_true',
dest='force',
default=False,
help='Import even if files are up-to-date.',
)
parser.add_argument(
'--import',
metavar="DATA_TYPES",
default='all',
dest='import',
help='Selectively import data. Comma separated list of data ' +
'types: ' + str(import_opts).replace("'", ''),
)
parser.add_argument(
'--flush',
metavar="DATA_TYPES",
default='',
dest='flush',
help="Selectively flush data. Comma separated list of data types.",
)
@_transact
def handle(self, *args, **options):
self.download_cache = {}
self.options = options
.
.
.
Thanks!
Closed with #132.
On the migration show this error:
/env/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) django.db.utils.ProgrammingError: relation "cities_country" does not exist
The virtual server advise:
`