Reputation: 298
I'm just getting started with Django. I like to hack at things, so alongside the polls tutorial I'm also building my own experimental application. It has come to pass that I want to change the name of the experimental application and its associated project.
In the course of working on that, I decided to drop my current database and start over fresh. Something went wrong, I can't remember what. It's been several hours now, making progress here, googling that there.
The situation I now seem to be in is that Django refuses to notice changes in my models.py
. Currently, there are no migrations listed for the app when I run manage.py showmigrations
, although the app is itself listed.
I have tried deleting the migrations directory, changing the contents of the models.py
file, and combinations thereof, and also trying out various manage.py
commands that looked promising. So far, nothing has worked.
So, what might I be doing wrong? Remember that I have changed the name of the app, which includes changing the name of directory it is stored in, as well as the name of the database. Search and replace has been performed on the files in the project and app. settings.py
has been pored over, but everything I know about seems to match up fine.
Thanks!
Upvotes: 1
Views: 601
Reputation: 1592
I assume you have changed your app name in your settings.py? And when you say you changed your app name, did you start a new app or a new project... meaning, when you start you do this:
django-admin.py startproject myproject
Running startproject gives you the following folder and file structure:
├── manage.py └── myproject ├── __init__.py ├── settings.py ├── urls.py └── wsgi.py
From there, you can run
python manage.py startapp myapp
This will make your folder structure look like this:
├── manage.py ├── my_django15_project │ ├── __init__.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py └── myapp ├── __init__.py ├── models.py ├── tests.py └── views.py
From there, you could change your app by changing the folder name 'myapp' to 'mynewapp' and then by modifying your settings.py to have 'mynewapp' listed in your INSTALLED_APPS section.
After doing this you should run
pythonmanage.py makemigrations mynewapp
Verify that it makes the migration files
then run
python manage.py migrate
If you changed the folder myproject to a new name, such as mynewproject, I would suggest to try changing it's name back, then running
django-admin.py startproject mynewproject
then after you do that, update those files accordingly, and copy your myapp folder into the mynewproject folder.
Some other things you may want to check are that your database connectors are correct, and also try restarting your webserver.
If none of this works, you will need to give me some more information, so leave me a comment and let me know
Good Luck
Upvotes: 1