Hi, 

before even thinking to use 'South', I want to get it to work quick and 
quick. I don't care about existing databases, I have no information in the 
database anyway. Is there a way to just recreate a new, empty database from 
scratch? Really, remove the old database and create a new database so that 
it corresponds the one I have defined in models.py.


On the other side, I am not able to look at the database myself, because 
when trying to open it I get the error:

   ERROR 2002 (HY000): Can't connect to local MySQL server through socket 
'/var/run/mysqld/mysqld.sock' (2)

Is there a way to access the database, and to possibly alter it, via 
"python manage.py shell"?


Thanks
  Alex

On Friday, April 13, 2012 3:10:33 PM UTC-5, Daniel Roseman wrote:
>
> On Friday, 13 April 2012 19:33:07 UTC+1, alex3627 wrote:
>>
>> Here is a repetition of what exactly I have done:
>>
>> 1. Add this field in my models.py
>>
>> 2. Run " python manage.py sql  jobs" (jobs is the name of the directory); 
>> in this step the field in question is explicitly written to stdout
>>
>> 3. Run "python manage.py syncdb"
>>
>> 4. Run "python manage.py runserver"
>>
>> 5. Go to the admin webpage to look at "jobs", and get this error. 
>>
>> Maybe I missed something? Or had the wrong order? Even if I repeat those 
>> steps I get the same result. 
>>
>>>
>>>
> So, as Timothy says, you added since you originally ran syncdb.  The 
> documentation[1] is clear that this doesn't work:
> "Syncdb will not alter existing tables
> syncdb will only create tables for models which have not yet been 
> installed. It will never issue ALTER TABLE statements to match changes made 
> to a model class after installation. Changes to model classes and database 
> schemas often involve some form of ambiguity and, in those cases, Django 
> would have to guess at the correct changes to make. There is a risk that 
> critical data would be lost in the process.
> If you have made changes to a model and wish to alter the database tables 
> to match, use the sql command to display the new SQL structure and compare 
> that to your existing table schema to work out the changes."
>
> Or, as Timothy also said, use South.
>
>  [1]:https://docs.djangoproject.com/en/1.3/ref/django-admin/#syncdb
> --
> DR.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/w6JgToJE30cJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to