Hello,
My opinion is that you should definitely switch to PostgreSQL, although I'm not aware whether this would make migrating easier. I've written a relatively long post about which database to choose in production.
Second, just to make things clear, the word "migration" has two meanings. The original meaning of migration is to switch to another software system (e.g. migrate from MySQL to PostgreSQL, or migrate a repository from subversion to git). In Django, the term "migration" means something else: to update the database to the new schema. In my opinion this terminology is wrong and confusing (apparently it comes from Ruby on Rails, but I'm not certain), and a better one would have been "dbupdate" or something, but since it's migration we'll keep it and you'll have to understand which meaning is meant in each case.
What your problem is cannot be understood with your general exposition, however after you gain a little bit of experience with migrations you shouldn't have any such problems. Migrations are tricky to understand but once you do they work flawlessly. The next time you have a problem give us some information with the exact error message so that we can explain what's wrong.
Regards,
Antonis
Antonis Christofides http://djangodeployment.com
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/16d60ab0-51e8-42a3-8f42-f4753f0adda3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Second, just to make things clear, the word "migration" has two meanings. The original meaning of migration is to switch to another software system (e.g. migrate from MySQL to PostgreSQL, or migrate a repository from subversion to git). In Django, the term "migration" means something else: to update the database to the new schema. In my opinion this terminology is wrong and confusing (apparently it comes from Ruby on Rails, but I'm not certain), and a better one would have been "dbupdate" or something, but since it's migration we'll keep it and you'll have to understand which meaning is meant in each case.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL13Cg_0p1pMtMR2y2eGry1UhQaSRpswntcnMWtHNdPgV1Ph9w%40mail.gmail.com.
To post to this group, send email to djang...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d878688d-00a3-452d-8cb8-956dcf41a52e%40googlegroups.com.
Here’s a “problem” with migrations that I’ve had. It only occurs on a first time installation (like a first-time upload to Heroku, for example).
In forms.py, I have a field dependent upon a column in another table (Category):category = forms.TypedChoiceField(required=False, choices=[(category.pk, category.name) for category in Category.objects.all()])
# later in forms.pycategory = forms.TypedChoiceField(required=False, choices=get_categories)This has a similar effect to the ModelChoiceField, with the query only running when the form is instantiated, but gives you the flexibility to use whatever logic you'd like to come up with the choices for the field.
my_project/ config/ docs/ accounting/ invoices/ __init__.py admin.py models.py urls.py views.py purchase_orders/ __init__.py admin.py models.py urls.py views.py __init__.py admin.py models.py urls.py views.py engineering/ products/ product1/ sub_product1/ __init__.py admin.py models.py urls.py views.py __init__.py admin.py models.py urls.py views.py product2/ __init__.py admin.py models.py urls.py views.py __init__.py admin.py models.py urls.py views.py requirements/ utility/
Thanks for all the advice.One more question - could project structure be causing issues with migrations? I'm working on a large project and many apps in my project have several layers of "sub-apps". My structure looks something like this...
A few things about my structure - I read in "2 Scoops of Django" that, in general, if you have more than 5 models per model file then you should think about splitting the model up into different apps, rather than having long models files. And I structured it this way so that it would be a little easier to manage - instead of having all apps under the project folder, engineering apps would belong in the engineering folder, etc.Thanks again
Hi,
I read in "2 Scoops of Django" that, in general, if you have more than 5 models per model file then you should think about splitting the model up into different apps, rather than having long models files.
I don't claim to be more experienced than the authors—on the contrary—and I have learnt loads from this book. However I disagree with this assertion. Five models is very few. In addition, I've found early splitting to usually be YAGNI. It causes more problems than it solves. Unless there is an obvious logical distinction of functionality right from the start, put all your models in the same app. When it grows and you see an obvious way to improve its structure, go on and refactor. Don't "refactor" from the start before you even understand your app's structure.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d4cc32e5-c9c1-48d7-bb19-a6646800ce3d%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/kzNqB9lEIGA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciV7tZS8WJeFyn1p5MQrctM6pympBPK2btm38FshX%3DSX1Q%40mail.gmail.com.
One more question - is there a way to put apps in folders/sub-folders instead of creating sub-apps/modules? I just want to keep things easier to navigate on the development side. I will eventually have about 20 sub-apps in the 'Engineering' app alone.Even if I could just group all the engineering sub-apps i have now under an engineering folder without any further hierarchy that would help as there will also be HR, financial apps, administration apps, etc.Thanks again
(business_management) C:\Python36\Projects\business_management>python manage.py migrate --settings=config.settings.localTraceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "C:\Users\Alexander\Envs\business_management\lib\site-packages\django\core\management\__init__.py", line 363, in execute_from_command_line utility.execute() File "C:\Users\Alexander\Envs\business_management\lib\site-packages\django\core\management\__init__.py", line 355, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Users\Alexander\Envs\business_management\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "C:\Users\Alexander\Envs\business_management\lib\site-packages\django\core\management\base.py", line 330, in execute output = self.handle(*args, **options) File "C:\Users\Alexander\Envs\business_management\lib\site-packages\django\core\management\commands\migrate.py", line 86, in handle executor.loader.check_consistent_history(connection) File "C:\Users\Alexander\Envs\business_management\lib\site-packages\django\db\migrations\loader.py", line 298, in check_consistent_history connection.alias,django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency accounts.0001_initial on database 'default'.
File "C:\Users\Alexander\Envs\business_management\lib\site-packages\django\core\management\commands\migrate.py", line 86, in handleexecutor.loader.check_consistent_history(connection)File "C:\Users\Alexander\Envs\business_management\lib\site-packages\django\db\migrations\loader.py", line 298, in check_consistent_historyconnection.alias,django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency accounts.0001_initial on database 'default'.let me know if you need anymore info to help me out with this. Thanks in advance
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/kzNqB9lEIGA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUKFGrv62awj%2BuuSSuVaS9uYqVs2%2Brv%3DJPsaxvmJGNTfg%40mail.gmail.com.
I'm not specifying the app level, I'm just running "python manage.py makemigrations --settings=config.settings.local" and "python manage.py migrate --settings=config.settings.local"I'm not modifying the migrations files and I dont have an app with the label of admin, thats just the built-in admin. Thanks
business_management/ business_management/ accounts/ migrations/ __init__.py admin.py forms.py models.py tests.py views.py static/ templates/ config/ settings/ __init__.py base.py local.py production.py __init__.py docs/ (developer documentation) requirements/ (requirements.txt files) utility/ (shell scripts) manage.py .gitignore
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0686084f-1d5a-4f61-823e-7d84c58f317c%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0686084f-1d5a-4f61-823e-7d84c58f317c%40googlegroups.com.
--Melvyn Sopacua