I am pretty new to Python, and I recently took on a project in which I am supposed to create a google sheets add on in python that edits that specific sheet when it is used.
https://developers.google.com/workspace/add-ons/guides/alternate-runtimes
I stumbled upon this tutorial, but I am very lost. I do not understand what "Pick your hosting infrastructure and set up your HTTPS endpoints" means, and I was able to follow steps 1-8 under "Create a Deployment Resource", but I was lost on step 9.
Could somebody help me with this task?
Picking your hosting infrastructure is saying to basically pick your server provider. Hosting just refers to servers because everything on the web needs to be hosted for everyone to access. HTTPS endpoints are urls that points to the location of resources in the server.
Step 9 was referring to creating a json file with information about your add on. I'm not particularly comfortable with JSON but from my understanding it's just using attribute:value pairs like CSS but it's used for storing and transmitting information.
Really hopes this helps, don't give up and dont get intimidated by this terminology. Best of luck!
Related
Im creating a server in Python that receives POST requests, process the information in the request using some scripts (sometimes using a database) and send back a answer in JSON format. Im searching for a way to run this server and code in the cloud, in a way that i dont need my PC turned on for it to work, because my connection is very unstable.
There are a lot of web hosting companies out there, you just need to find the one that is right for you.
My personal favorite for python apps is heroku, but there are many out there. AWS is another popular one.
In future when asking questions, try to do more research before hand, and try to be more specific with questions. It would have been useful to know what kind of database you are using, or whether you're using flask or django.
I'm tasked with creating a web app (I think?) for my job that will tracker something in our system. It'll be an internal tool that staff uses to keep track of the status of one of the things we do. It should look like trello, with cards that drag from step to step. That frontend exists, but my job is to make the system update when the cards are dragged. This requires using an API in Python and isn't that complicated to grab from/update. I have no idea how to put all of this together. My job is almost completely nontechnical and there's no one internally who knows what I'm doing except for me. I'm in so over my head here and have no idea where to begin. Is this something I should deploy on Elastic Beanstalk? EC2? How do I tie this together and put it somewhere?
Are you trying to pull in live data from Trello or from your companies own internal project management tool?
An EC2 might be useful, but honestly, it may be completely unnecessary if your company has its own servers. An EC2 is basically just a collection of rental computers to help with scaling. I have never used beanstalk so my input would be useless there.
From what I can assume from the question, you could have a python script running to pull from the API and make the changes without an EC2.
First thing you should do is gather as much information about what the end product should look like. From your question, I have the feeling that you have only a vague idea of what the stakeholders want. Don't be afraid to ask more clarification about an unclear task. It's better to spend 30 minutes discussing and taking note than to show the end-product after a month and realizing that's not what your boss/team wanted.
Question I would Ask
Who is going to be using this app? (technical or non-technical person)
For what purpose is this being developed?
Does it need to be on the web or can it be used locally?
How many users need to have access to this application?
Are we handling sensitive information with this application?
Will this need to be augmented with other functionality at some point?
This is just a sample of what I would ask, during the conversation with the stakeholder a lot more will pop up for sure.
What I think you have to do
You need to make a monitoring system for the tasks that need to be done by your development team (like a Kanban)
What I think you already have
A frontend with the card that are draggable to each bin. I also assume that you can create a new card and delete one in the frontend. The frontend is most likely written in React, Angular or Vue.js. You might also have no frontend framework (a mix of jQuery and vanilla js), but usually frontend developper end up picking a framework of sort to help the development.
A backend API in Python (in Flask or with Django-rest-framework most likely) that is communicating with a SQL database like postgresql or a Document database like MongoDB.
I'm making a lot of assumption here, but your aim should be to understand the technology you will be working with in order to check which hosting would work best. For instance, if the database that is setup is a MySQL database you might have some trouble with some hosting provider.
What I think you are missing
Currently the frontend and the backend don't communicate to each other. When you drag a card it won't persist if you refresh the page. Also, all of this is sitting in your computer and cannot be used by any one from your staff. You need to first connect the frontend with the backend so that the application has persistance. Then you need to deploy this application somewhere so that it is reachable by your staff.
What I would do is first work locally to make sure that the layer of persistance is working. This imply having the API server, the frontend server and the database server running simultaneously on your computer to develop. You should then fetch data from the API to know which cards are there in the database and then create them visually in your frontend at the right spot.
When you drop a card to a new spot after having dragging it should trigger a POST request to your API server in order to update the status of this particular card (look at the documentation of your API to check what you need to send).
The server should be sending back an updated version of the cards status if the POST request was sucessful, so your application should then just redraw the card at the right spot (it won't make a difference for you since they are already at the right spot and your frontend framework will most likely won't act on this change since the state hasn't changed). That's all I would do for that part.
I would then move to the deployment phase to make sure that whatever you did locally can still work online. I would use Heroku to start instead of jumping directly to AWS. Heroku is a service built on top of AWS which manage a lot of the complexity of AWS for you. This is great for prototyping and it means that when your stuff is ready you can migrate to AWS easily and be confident that a setup exist to make your app work. You might also be tied up to your company servers, which is another thing I would ask to the stakeholder (i.e. where can I put this application and where I can't put it).
The flow for a frontend + api + database application on Heroku is usually as follow. You create a github repo for your frontend (make it private) and you create an app on Heroku that will watch this repository for changes. It will re-deploy the application for you when it sees a change at a specific subdomain of Heroku hosting. You will need to configure some procfiles that will tell Heroku what to do with a given application type. This is where you need to double check what frontend you are using since that might change the procfiles used. It's most likely a node.js based frontend (React, Angular or Vue) so head over here for the documentation of how to put that online.
You will need to make a repo for the backend also that is separate from the frontend, these two entities are distinct and they only communicate through HTTP request (frontend->backend) and JSON (backend->frontend). You will need to follow the same idea as with the frontend to deploy, head over here.
Once you have these two online, you need to create a database on Heroku. This is done by adding a datastore to your api, head over here. There are some framework specific configuration you need to do to make the API talk to an online database, but then you will need to find that configuration on the framework documentation. The database could also be already up and living on your server, if this is the case you just need to configure your online backend to talk to that particular database at a particular address.
Once all of the above is done, re-test your application to check if you get the same behavior as before. This is a usable MVP, however there are no layer of security. Anyone with the right URL could just fetch your frontend and start messing around with your data.
There is more engineering that need to be done to make this a viable end product. This leads us to my final remark: why you are not using a product like Trello, Jira, or even Github Project? If it is to save some money on not paying for a subscription I think you should factor in the cost of development, security and maintenance of this application.
Hope it helps!
One simple option is Heroku for deploy your API and your frontend application.
We have an app which is created with Ionic. We used firebase as backend. All authentication and couple of things handled by firebase. We have two major things which are done by python. First we are scraping web for some data and can put it as direct Json file to firebase. Second we have to take some data from firebase, put it on some machine learning library methods and should have new data which again will be stored in firebase.
Question
How can I add python code which will be running periodicly in every 24 hours inside firebase for both scraping and machine learning scripts?
Confusion
I am not really familiar with server side like I would run python scripts in Apache server or not I have no clue. Since we started with firebase, I have to know how it is done. Python codes are actually ready. I checked python-firebase as well. Evenmore, I have put my machine learning data into firebase. But I do not know where to put this python code. Only thing that I have accomplished is firebase is capable of taking Json files with just one button. I would have not enough knowledge about server-side scripts as well.
Conclusion
If someone can enlighten me, I would deeply appreciate that.
Momentarily I am creating a python based application through the programme Ren'py. Now I have to couple the game with a SQL database. The admin on the board of the programme recommended using urllib to do this.
http://lemmasoft.renai.us/forums/viewtopic.php?f=8&t=29954
This is my thread. Now, I've managed to succesfully add the urllib to the program, but I'm lost at the entire "talk to a web service, which would then talk to the sqlite database" segment. Could you perhaps provide any hints/ tips?
I've never worked with Python before, so it's kind of challenging.
The answer you got on that forum isn't very helpful, in that the poster didn't really explain what they meant.
urllib is really the most minor component of the solution they're suggesting. What they actually mean is that you set up an entire web service, hosted on a URL somewhere, which talks to its own database. Your local installations of the app would then use a Python web library to communicate with that remote database over the web.
While this isn't particularly difficult, it is a fair amount of work, especially if you don't have any experience in doing this. You'll need a Python web framework and somewhere to host it. Since you talk about admins needing to log in and view data, you might want to explore Django, which comes with a built-in admin interface.
You'll then need to design an API to allow your Ren'py app to communicate with that web service, and you might want to look at the Django REST framework for that. The final part is getting your app to talk to the web service, which is where the recommendation of urllib comes in - but to be honest, that isn't even a very good recommendation here: the third-party library requests would be much better.
As I say, there's quite a lot of work. A much simpler solution would be to use Python's built-in sqlite3 library to talk to a local database via SQL, but that wouldn't do anything to make people's data available in a central location and would be open to anyone who worked out how to query the database.
I want to be able to give out a form, with essentially 4 inputs. Each time it is submitted, I would it to trigger a python script.
I'm not totally sure where to start here. I could have the python code live on a server somewhere and have the google apps script trigger it, but ideally I could do this without having to host my code somewhere else. I also would like to avoid paying for anything...
Any and all advice would be appreciated. Please assume I have only a small amount of knowledge about this kind of stuff.
Check out this tutorial on the AppEngine documentation.
https://developers.google.com/appengine/docs/python/gettingstartedpython27/introduction
It will help you set up using Python and WebApp2 (for your forms!) and storing this data to datastore if you wish. You could just expand and modify the guestbook tutorial they make you do to have your application/script do exactly what you need it to. It's an excellent tutorial to get started even if you don't have much knowledge about python or appengine.