How to Connect into a MySQL in azure server using SQLAlchemy - azure

I need some help. I created a CRUD with Flask, and I want to conect it with my MySQL in azure. I new using Flask, so I don't know how to do it. Somebody can help me?
Now, I tried to do this:
app.config['SQLALCHEMY_DATABASE_URI']'mysql://Myuser#Myuser:MyPasswrd#MyDataBase:3306/mySchema'
My localhost works, so, I tried to change the username,passwrd and database and thought that it would work. But it didn't. I can access my Mysql-azure via workbench btw.
Thank you for reading!

I tried it here, and I got an error, I'll put a photo here. idk if this errors is because I dont have a MySQL connection, or something (I was using but I removed to see if it would work). Here a print of my instance.py and the error Instance of server

It should work after installing mysql-connector.
pip install mysql-connector
change the SQLALCHEMY_DATABASE_URI in your python script to below and create your database.
app.config["SQLALCHEMY_DATABASE_URI"] = "mysql+mysqlconnector://{username}:{password}#{server}/testdb".format(username, password, server)
let me know if you see any specific error

Related

Website on nodejs and mongodb typeerror cannot read properties of undefined (reading 'date') after moving to new server

I hope I'm in the right place.
We have a problem with our website. We only got files and a database from the previous admin. I uploaded them to the server and the site is partially working.The problem arises when we click one of the links to articles on the site. The place where the article should be placed is empty. The console in chrome says:
TypeError: Cannot read properties of undefined (reading 'date')
at Cn.eval (eval at Qa (vue.js:6:92206), <anonymous>:3:386)
at e._render (vue.js:6:35554)
at Cn.r (vue.js:6:68565)
at pn.get (vue.js:6:26867)
at pn.run (vue.js:6:27751)
at ln (vue.js:6:25859)
at Array.<anonymous> (vue.js:6:12476)
at We (vue.js:6:11877)
and a warning:
"DevTools failed to load source map: Could not load content for https://example.com/js/axios.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE"
I read about it on stack and other pages and it seams that the variables aren't defined.
It was working on the previous server. :(
As I understand it, when I copied the files and the database and installed all the dependencies it should work? Or is there anything that I'm missing?
I think that connection with database works, other parts of the website are working and some of the data for the website is working fine.
It seams like there is something missing, but I have no idea what.
Can it be that because of the missing axios.map file the js can't define some of the variables on the website?
What could have caused it during the transfer? Some files missing? collection error in mongodb?
I'm struggling for over a week now, and I ran out of ideas for the moment...
Is there any way I can debug it?
I'm not a js programmer but a simple admin and I'm getting kind of confused. Has anyone had such a problem?
If anyone needs any more info please let me know.
What I did:
installed nodejs via nvm install 12.18.4 //it's the version on which it was working earlier, on previous server
installed mongo and imported collections to the database in json format
installed and configured nginx to handle the request foe the website
deleted the modules folder and npm install'ed them again

OperationalError at /register/

When I am trying to signup in django app on heroku, it's saying no such table: auth_user . I tried to run manage.py migrate -syncdb. It execute successfully but still the problem is same. I works perfectly in development environment.
What can be done to fix this.
I'm not sure what your auth_user model looks like, but I'm going to guess it has a Meta option of managed = False. Switching this to managed = True should resolve the issue. From the django documentation, this ensures that Django will create the necessary tables on migrate commands.
If this is not the case, please provide the code where you defined your model and I'll try an alternate route.

Firebase-admin fails silently to write to realtime database from nodejs

I’m trying to get setup using Firebase Admin on my nodejs app running on my Raspberry Pi.
when I call;
admin.database().ref().child("myPath").push({date: new Date()});
I’m not receiving any errors but no data is showing up when looking in the Firebase console at my database either.
I also tried chaining on;
set({date: new Date()});
and
push().set({date: new Date()});
Both also fail to write with no errors.
I've verified that my rtdb url and the project id in the service account file are correct for my database. And I've tried both requireing the file as in the docs and passing the credential object directly to;
admin.credential.cert()
I only mention that I'm running on Raspberry Pi because the issue I’m seeing sounds very similar to this Stack Overflow post where Firebase Admin won’t write to db. I’m wondering if it’s not coincidental.
Any ideas what I might be missing?
please can you try this code .....push().set({'date': new Date()});. Thanks. I am guessing it's takes a String as key and even the new Date().toStirng() would be good if i am not wrong.
Thanks,

Not able to pass Meteor.settings json file

On my local workstation, I can easily load my settings by passing --settings which works perfectly fine. For my dev/production server, I following the documentation AND a few postings here which have me create a file.json file with what i want to pass. I have a script which passes the export commands properly and then fails to pass my meteor settings.
METEOR_SETTINGS=$(cat /var/www/html/dev/dev.json)
Am I missing something? Any guidance would be most appreciated.
figured out the answer to this
when you run a script, you need to export METEOR_SETTINGS just like you would export the mongo url and port 3000.
Simple but overlooked based on replies from other posts.
I assume you bundled your application for production?
For me the following did the trick
export METEOR_SETTINGS="`cat settings.json`"

Mongodb / MongoHQ connection from Nodejitsu

I seem to be having trouble connecting to MongoHQ (via MongoSkin) on jitsu.
I can connect from localhost though, and all I'm doing is changing my env
var and jitsu deploying. It's just strange that it works locally but not
deployed. I had talked with someone on IRC but unfortunately I didn't find
a solution.
I did notice this, the first error, which is mine as well:
http://errors.jit.su/
Is Mongoskin having any issues like this?
I have also tried using other modules (node-mongo-native, etc), and
with the same results- I can connect locally to MongoHQ, but not on jitsu.
Thanks for any help or insights!
the following:
mongoose.connect('mongodb://username:password#subdomain.mongohq.com:port/collectionName');
works flawlessly both locally and on jitsu, at least for me.
thats the string that nodejitsu gave me when creating the db in their webinterface.
i never tried any other mongo orm so i cant help with any other method of getting a connection to mongo.
have fun
jascha
edit: using the latest versions of all scripts here
(package.json: "mongoose": "latest" and so on)

Resources