RedBeret / cashflow-ninjas-app

The Cashflow Ninjas App for Flatiron Hackathon – Personal finance management and budgeting tool.
https://redberet.github.io/cashflow-ninjas-app/
Other
0 stars 0 forks source link

configured ruby on rails and python to both use app.db inside of pyth… #25

Closed RedBeret closed 8 months ago

RedBeret commented 8 months ago

We achieved a setup where a Ruby on Rails application and a Python application share the same SQLite database file. This setup required several steps:

Database Configuration in Rails: We modified the config/database.yml file in the Rails application to point to the SQLite database used by the Python application. The path was set relative to the Rails application root to ensure Rails could locate the app.db file within the pythonserver/instance directory.

Permissions Adjustment: We discussed how to adjust file permissions to ensure both the Rails and Python applications could read from and write to the shared database file. This involved using chmod to set the appropriate permissions on the app.db file and ensuring that the directory containing it was accessible. It was not working for me as i created the db with python at first but permissions helped migrate.

Migration Handling in Rails: We used Rails migrations to create a new table in the shared database as a test, confirming that Rails could indeed operate on the database file. This was a proof of concept to ensure that our configuration changes in database.yml were effective.

Testing Database Connectivity: We tested database connectivity by creating a test model within the Rails application and performing a migration to create a corresponding table in the shared database. This allowed us to verify that Rails could successfully interact with the database file managed by the Python application.