I recently started working on some project with my friends. I'm working on backend with Django, and others do frontend. As they have no knowledge about Django, I was wondering if I can add the db file into the project folder, so that they can use the local db by just pulling the db file from Github repository.
When I used to use sqlite3, I could do this simply having the sqlite3.db file in my project folder. However, PostgreSQL has me use its program to create database, I'm confused how I can get the db file.
Is it possible to have a local PostgreSQL db file in my Django project so that my friends use the db by just cloning the project and installing PostgreSQL in their computers?
Just so you know, I created my Django project with cookiecutter-django.
Related
Where is postgreSQL database saved in a django folder (that which has manage.py)?
If not, I presume it must be stored in postgres folder of root directory.
Then, how to transfer this file to those systems having no postgres installed, so that when they run server, they can see seamlessly all the data/app?
Can we ask DJANGO to create the database file in its project folder itself and does this help in such transfers? Thanks.
I am developing an app with Django and I successfully pushed it on Heroku.
This app has a postgres database and a form to allow users to fill the database.
I have coupled the local directory and Heroku, so that both if I run the server by command prompt, or if I access the app, and submit the form, my database get changed.
Now I want to make some experiments on the local database without changing the one on Heroku.
Is it possible?
Can I do it by just commenting the database URL in settings.py ?
I have searched for this matter on Google but I don't know the name it, so that I cound not find proper answer.
This is not a question of "decoupling" directories. It is because you are trying to use sqlite on Heroku, and you have added the sqlite file to your git repo.
You cannot use sqlite on Heroku; use the postgres add-on. Additionally, your sqlite file must not be in source control.
I have developed django project on my computer. I used virtuelenv and installed all libraries and packages there. I also have postgreSQL database on my computer. How could I deploy my existing server with all files and libraries, my postgreSQL database with all tables and all rows to digitalocean. I only found tutorials on how to create new django projects on digitalocean.
Actually there is plenty of tutorials and documentation for doing this.
https://www.digitalocean.com/community/tags/django?type=tutorials
In the other hand you only have to migrate your data base from your computer to your new server. Maybe you should check this
I want to migrate my django's database from MySQL to PostgreSQL.
Previously I've used database configuration options just like this example from Django website.
The MySQL engine on database setting has options: 'read_default_file', so I can separate my database credential on external file.
Now I'm ready to switch to PostgreSQL with psycopg2 engine, but I can't find the similar options like read_default_file.
Is there any solution for this?
Or may be I should change to other database engine of PostgreSQL which has this options? Thanks
read_default_file is purely a mysql thing. It cannot be used for postgresql. The closest equivalent in postgresql is the .pgpass file which is a file that needs to be created in the home directory of the user running the psql client. That defines the user's password.
When you are using django in development creating a file in your your home directory would do the trick. But in production you are not supposed to run the django dev server. Production WSGI servers run under restricted user accounts that may not have a home directory. In that case you need to use the PGPASSFILE environment variable to tell django where to look for the password.
I followed the wiki on http://wiki.dreamhost.com/Django .
Django is installed in my site's directory and I've even created my first project, now what do I do ?
You can copy your project files to the server and transfer your database to the sql server on dreamhost. Don't forget to make changes in your settings.py to reflect the environment. Should work otherwise me thinks.