I want my database deployed on sqliteonline instead of django admin but i am stuck at how to do that. Thanks in advance. It will be of much help!
I hope you are keeping well.
I believe from my understanding that you are misinterpreting what SQLITEONLINE is. It is simply a web-based database IDE.
If you want to host your database remotely for Django, I would recommend changing from the Django default of sqlite as this is a database designed for local storage and not remote connectivity.
To change your database to a remote one, you could go to a SQL database and connect remotely by adjusting the settings in your settings.py file. See Django's documentation on the topic here.
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/
I have written a web app in django using mongoengine as a driver and am trying to host my database on mongodb cloud. In mongoengine's connect() method, according to what I understood from the documentation, specifying the url (specified in the connect section on the mongo cloud site) in the hostname argument should do the trick, however requests from the app to the mongo cloud keep timing out.
Where am I going wrong?
This is the call to the connect method in my setting.py file-
mongoengine.connect(db='scheduler', host='mongodb+srv://<user>:<password>#cluster0.oualt.mongodb.net/<db name>?retryWrites=true&w=majority')
Update: the specific error thrown on using the above url is this-
ServerSelectionTimeoutError
If you're using just mongoengine then Django will not detect that connect to the database, so you will not be able to use the Django ORM system to save instances of models etc.
If you want to use the ORM you would have to use a package like Djongo or djmongoengine
However, if you're not planning to use the ORM system then you can use just mongoengine.
I believe the connect url should be in this format:
mongodb+srv://<username>:<password>#<database-name>.mongodb.net/test?retryWrites=true&w=majority
Right now you seem to have the url to a specific cluster on your database.
So I was going through similar posts which had the same error ServerSelectionTimeoutError with djongo and pymongo as the drivers and one of the posts said that they had forgotten to whitelist their IP address on the mongo cloud site. I had done that during signup, but I repeated it anyways and for some reason the IP address was different and after that had been whitelisted, my app connected and started working. I have no explanation.
mongoengine works fine, but in terms of protocols you need another ext file that serves for your connection protocols, just pip install pymongo[srv]
def register_database(db_name:str):
connect(db=f"mongodb+srv://<username>:<password>#<cluster-name>.nwr5l.mongodb.net/{db_name}?retryWrites=true&w=majority", alias="default")
Is it reliable to build desktop applications using web frameworks like Django?
The idea is to
build the interface with HTML, CSS, and JavaScript
use Python and Django for backend operations (calculations, storage and databases, etc)
and then run a server locally so that
the interaction with the application is done through the browser
other local devices can access the application by connecting to the device on which the server is running.
If that is possible and yields a reliable experience, then
is the development server that comes with Django enough? If no, what servers are most suitable for our purpose? Is Nginx good for example?
what database should be used? PostgreSQL, MySQL, etc? The app will need to store a large number of entries.
I've never done this, but I can't see why not. You can use the Django REST Framework to create an API that your desktop application can talk to, in exactly the same way as you might with a JavaScript single page app.
But no, you should not use the dev server for production, even in a limited scenario like this. Apache/mod_wsgi or nginx/gunicorn are simple to set up and deploy.
For the database, it makes no difference. The Django core devs prefer postgres, but you should use whatever you are comfortable with.
You are asking for a webApp, so yes you can. Is not use the Django server, instead is very common use nginx for Django, and the best database is postgres for Django.
If you want to pass your project like a desktop app is better use Django server and SQLite for avoid create a new database server.
Database
I find this answer explaining why is postgres better for Django
I have a lot of old vbscript webpages using Classis ASP. Those ASP pages have lots of different databases queries to different databases all inside a given .asp file. I want to write those in Python and use Django as the framework. Will I be able to do this? I'm not sure how to start after I install Django. Sure, I can make a demo work, but that's not what I'm after. I will use the normal database "things" in MySQL or PostgreSQL, but sooner or later I have to hit those other databases and bring them back into Django, using Django's templating and so on.
Will I be able to do this? How do I make a model that queries my legacy SQL Server and Oracle database and send that to the view? Am I "fighting the framework" to accomplish this?
Just to be clear. I am not interested in messing with the stock database that Django uses for it's settings. That can stay as it is. I want to use that part for plugins, security (ldap), etc.
Thanks.
You can query different databases in your ORM calls by leveraging the using statement: https://docs.djangoproject.com/en/1.5/ref/models/querysets/#using
This would allow you to set up as many database definitions as you need in settings.py, then specify which DB to query at the view level. That way, you wouldn't have to change your model definition should you decide to consolidate your databases, etc.
Have you reviewed the Django multiple databases documentation?
Django has a built-in Oracle back end, so that should be fairly straightforward.
SQL Server can work through django-pyodbc but I found it fairly painful to set up. If you already have a generally working ODBC connection to your legacy SQL Server database connection from your Django environment it's no big deal, but it took me some trouble to get things set up to where I could use tsql to connect to my SQL Server database.
I also had some trouble with Unicode data from the SQL Server database until I forced it to use the appropriate (later) version of TDS. I just needed it for a script or two, so I set the 'TDSVER' environment variable and left it at that, but in theory there are other places you can set that.
Recently, i am working on a project using Sitecore Azure.
when creating a web form, we use Web Forms for Marketers module provided by Sitecore.
It works fine in local environment. but when we publish it to Azure. it dose not work.
Because there is no database for web form in Azure.
Has anyone experienced this before, maybe you guys can help me. Thanks
Finally, i get it down.
first, you need to create a same database for WFFM as the local one Sitecore_WebForms in SQL Azure.
Here is a link tells you how to do it.
second, change the connection string in forms.config to point to the database in sql azure.
here is a example.
<formsDataProvider type="Sitecore.Forms.Data.DataProviders.WFMDataProvider,Sitecore.Forms.Core">
<param desc="connection string">Database=Sitecore_WebForms;Data Source=tcp:YOURSERVERNAME.database.windows.net,1433;user id=YOURID;password=YOURPASSWORD;Connect Timeout=60</param>
</formsDataProvider>
This is how i fix it. Hope it helps if anyone has the same problem.
Only Web Forms for Marketers (WFFM) 2.4 or higher is compatible with Sitecore Azure module. Additionally, you must use SQL Server version of WFFM database, which must be shared between all WebRole Instances. Please check the details here: https://kb.sitecore.net/articles/880886
How to add WFFM database in Sitecore Azure and automatically deploy it with entire Sitecore solution read in the following article: https://kb.sitecore.net/articles/179306
Best Wishes, Oleg