I am trying to develop a mongo only api application with rails. After removing the sqlite gem and database configuration I am getting following error:
Cannot load Rails.application.database_configuration: Could not load database configuration. No such file - ["config/database.yml"]
When I put an empty file there, it gives me an error about not finding development database adapter.
I am using mongo and I will never be using a rdbms, how can I get rid of these errors, one solution is to keep dummy database, but it would create trouble when deploying to heroku.
How can I setup mongoid correctly, so that the application does not asks me for a traditional database configuration?
Find a good answer here. Basically you have to comment out all the references to "active_record" in the config folder.
Related
Currently I have a Django application running on my personal website from PythonAnywhere.com. When I make updates to the site I login to PythonAnywhere and git pull to update my application. When I do this the data that was entered through the website since the last update gets lost from the database when I update. What can I do to overcome this?
I am currently using the SqlLite version that comes preinstalled with the Django App. This likely could be part of the issue but need some help understanding how to overcome it.
I presume that your Django project is connecting to the SQLite database that gets generated when you create a new project and you are pushing that database in your deployment. That database won't be suitable for production and won't retain your changes, you instead need to setup a database that your application can connect to.
Here is some information on PythonAnywhere about databases:
https://help.pythonanywhere.com/pages/KindsOfDatabases/
And the Django documentation:
https://docs.djangoproject.com/en/4.0/ref/databases/
Maybe this is a super silly question. I am new with Django stack web app development.
I am following Django tutorial on MDN. I entered information to the backend database via the admin page. But some error happened later so I had to uninstall pyenv and restart. I wonder if I can find all the information I entered which is not on any project documents. Thanks.
Assuming you're following the tutorial closely and they don't specify a database to store information in, there should be a sqlite3 database in your project file system
I have built an app which uses Django as a Rest API (Django rest framework). After having deployed the code on digital ocean using production grade services, everything works well. The postgresql database populates itself correctly . There is no reset of the server like on Heroku.
Except, if I change a file and push the change through gitlab(Digital ocean picks up the change and automatically deploys the updated version of the server), the database resets to its original state. I would like the server to stay as.
I have removed all migration files before pushing updates, but to no avail. I imagine it has to be something rather trivial but I can't find it.
The database is hosted also by digital ocean. I havent done any configuration. Wouldn't it be managed automatically as DO deploys the code on its servers?
I figured out what went wrong. Using the sqlite db while developping is one thing, but assuming when deploying your django app on a service provider that it will handle the whole db management is a 1000 steps too far.
Logically, whenever I pushed a new update to the server, the db would reset using the sqlite local db file of the project.
So I created a specific db on digital ocean, change the database config on the settings file of my django project to connect to it. Making the project use the external db. then I Just had to migrate project db structure to the external db.
And Voila. problem resolved
When i'm deploying a Django project (tried two of them) in Azure App Services (Linux), i always get the error SQLite3 database locked: OperationalError: database is locked,when trying to log in. Has someone an idea or workaround to resolve the problem without changing to another database? I changed the default timeout as mentioned by the official django documentation: https://docs.djangoproject.com/en/2.2/ref/databases/#sqlite-notes, but the problem remain. I want to keep using sqlite database!
Thanks for your help.
App Service locks the db.sqlite3 file, preventing both reads and writes. This behavior doesn't affect an external database:
https://learn.microsoft.com/en-us/azure/devops/pipelines/languages/python-webapp?view=azure-devops#considerations-for-django
https://vscode-eastus.azurewebsites.net/docs/python/tutorial-deploy-app-service-on-linux
Test App: https://github.com/itsimplified/slick-crud-app
However, you should be able to use the following way to make the WebApp work by moving the SQLite to Azure Storage.
Please follow the below steps in order to achieve this:
Mount your Azure Storage to the WebApp:
Example:
Make necessary changes to the path of the DB file in the application:
Example:
You should also be able to see the DB file in the Storage:
I'm trying to deploy my Django app to Heroku using Neo4j's Addon.
I'm using Neo4django. Locally, in my settings.py I have the following
NEO4J_DATABASES = {
'default' : {
'HOST':'localhost',
'PORT':7474,
'ENDPOINT':'/db/data'
}
}
However, when deploying to Heroku, I change the settings to
NEO4J_DATABASES = {
'default' : {
'HOST':'<someid>.hosted.neo4j.org',
'PORT':7281,
'ENDPOINT':'/db/data/',
}
}
.. I am unable to connect to the database for authentication problems apparently.
The error at the bottom of my stack trace:
StatusException: Error [401]: Unauthorized. No permission -- see authorization schemes.
Authorization Required
.. even when I add the login and password provided by the Heroku Neo4j add-on.
Did anyone run in a similar issue before?
Thanks in advance
The Heroku-hosted Neo4j has the Gremlin plugin disabled, which is going to prevent you from running neo4django, bulbflow, or any other client-side library that requires Gremlin.
The most common solution is to run your own instance of Neo4j on AWS, and then connect to that. Please make it clear to the Neo folks that you'd like Gremlin support on Heroku- I think it was disabled because of the shared nature of the Heroku Neo4j instance, but it absolutely hobbles a number of libraries.
You can see the Neo4j config url by using heroku config --app your-app. Just use the NEO4J_URL from the environment variable in your code setup. It already contains the credentials for basic auth.
I've got this working by using graphenedb.com to host my neo4j database.
They will allow you to chose the version of neo4j that you would like hosted. If you pick 1.9.6 (or earlier), then the gremlin plugin works and so will neo4django.
You can either sign up with graphenedb via their website and create your db there or just use their heroku plugin (http://blog.graphenedb.com/blog/2014/02/06/our-new-add-on-helps-heroku-users-build-applications-on-top-of-neo4j/) which will do it all for you. The only advantage I've found of using the web interface is that you'll also get the neo4j webadmin.