I am developing an application in Django using sqlite on windows.Will this db work on a linux machine? If not, how do i replicate the data on the new db on linux (creating scripts is one way)?
SQLite is compatible with both Windows and Linux platforms.
The database file format is cross-platform - you can freely copy a database between 32-bit and 64-bit systems or between big-endian and little-endian architectures. These features make SQLite a popular choice as an Application File Format.
Source: http://sqlite.org/about.html
As Robert writes, SQLite files should work on any platform. If you decide to switch to MySQL or PostgreSql you can run the following (standard) command to save your database on the Windows machine:
manage.py dumpdata <app1> <app1> > mydbdump.json
and then configure the settings.py on the Linux machine for the MySQL or PostgreSql database and run:
manage.py syncdb
manage.py loaddata ./mydbdump.json
I have successfuly done this on several occasions to switch from MySQL to SQLite it worked fine.
Just for reference, you can omit the listing in the dumpdata command to dump data for all installed apps but it will not be possible to load it back in. The all-inclusive dump will contain some internal Django records such as default content types and user authentication which are also created by the syncdb command. So you get errors like
IntegrityError: columns app_label, model are not unique
List the specific apps that you want to dump and load and it will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With