Deploy a connection between two platforms' APIs - python

I know this is not exactly the right type of questions for Stack overflow but I am struggling here and I would greatly appreciate your opinion(suggestions/advices) on the matter.
I am working on an script that works with APIs of two different websites (or even platforms). I have almost developed what I need but as calls to the APIs and information processing.
What my question is, how can I deploy this application online so that it works constantly without me having to keep my computer turned on so that it runs on it? In other words, where can I deploy this app on a server maybe and have it running all the time ? I know it is possible but I really cannot find quality information myself. So if you can either point me a direction or provide links, give advices, that would make my life a bit easier in finishing this project of mine.
Thank you a lot in advance!

Related

Need help talking to WhatsMiners using Python

For a project I am trying to communicate with an ASIC bitcoin mining machine, specifically a WhatsMiner using Python.
There is a pretty decent guide online that outlays the basic structure of how to do this, and the commands it shows work great on my miner.
However, what I am wanting to do is be able to set both the 'power percent', as well as the 'target frequency' of the machine.
The json format of how these are to be written is outlined in their API documentation which I have included screenshots of.
Throughout university, I haven't touched much json, so am having some trouble with this. To give you an idea of what I am doing, I have followed the GitHub guide above and changed the 'cmd' parameter to either "set_power_pct", or "set_target_freq". I then have changed the 'additional paramaters' to the corrosponding values outlined in the API guide.
Sorry if I am just making a dumb mistake, I really appreciate anyone's help!
Thanks
Beyond this, I have spent a bit of time search google, as well as tested this while connected to the miner. The code is not throwing up any errors, but just isn't changing how the miner is running. As I had alluded to, when I try simple commands to turn the miner on or off, this works fine.

Can someone explain debugging / Pycharm's debugger in an easy to understand way?

I have reached the stage in developing my Django project where I need to start debugging my code, as my site is breaking and I don't know why. I'm using Pycharm's IDE to code, and the debugger that comes with it is super intimidating!
Maybe because I am a total newbie to programming (been coding only since May) but I don't really understand how debugging, as a basic concept, works. I've read the Pycharm docs about debugging, but I'm still confused. What is the debugger supposed to do/how is it supposed to interact with your program? What helpful info about the code is debugging supposed to offer?
When I previously thought about debugging I imagined that it would be a way of running through the code line by line, say, and finding out "my program is breaking at this line of code," but "stepping through my code" seems to take me into files that aren't even part of my project (e.g. stepping into my code in admin.py will take me into the middle of a function in widgets.py?) etc. and seems to present lots of extra/confusing info. How do I use debugging productively? How can I use it to debug my Django webapp?
Please help! TIA :)
A can leave you some links i found useful when i got to that same point - i cant get you a more comprehensive explanation on the topic than this materials do.
Debugging is fundamental as you said and very broad. But this videos and links should get you start with more confidence.
https://www.youtube.com/watch?v=U5Zi2HDb2Dk
https://www.youtube.com/watch?v=BBPoInSOiOY
https://www.youtube.com/watch?v=QJtWxm12Eo0
http://pedrokroger.net/python-debugger/
https://waterprogramming.wordpress.com/2016/04/08/debugging-in-python-using-pycharm-part-1/
https://waterprogramming.wordpress.com/2016/04/08/debugging-in-python-using-pycharm-part-2/
https://waterprogramming.wordpress.com/2016/04/08/debugging-in-python-using-pycharm-part-3/
Hope that helps
It's really easy. You can debug your script by pressing Alt+F5 or the bug button in Pycharm IDE. After that the Debugger handle the execution of the script. now you can debugging line by line by F10, get into a function or other object by pressing F11. Also there is Watch Window where you can trace your variable values while debugging. I really encourage you to search blogs on internet. There are lots of tutorial in this area

How to properly set up this Sage Cell Server?

I have a question regarding the Sage Cell Server. It is a relatively general question, I don't have any code that I need fixed.
I am trying to set up a server but I am finding the world of servers confusing. I've worked plenty with Java and JavaScript, HTML and CSS on frontend stuff, but for the backend Sage server I decided to develop I figured Python was a good choice. Some basic Lynda tutorials and a book later, I have a pretty good idea how python works... But am still lost. My question is basically this:
-I am trying to design a very simple server running an instance of Sage. I want to be able to SEND Sage code to it (NOT PYTHON) and have it evaluated and the result sent back, as if I were running sage on my own computer. Example: Sending "integrate(x,x)" to the server would return 1/2*x^2
-What is the best way to go about doing this? Should I download the Sage Cell Server?
-Will I need to even write Python code for this? How long would this task take in hours?
-Would it be easier for me to design the server to receive and execute Python code instead of Sage code? How would I go about doing this?
If you are wondering why I want to do this, I want to design a website where people can type in their math problems and have them evaluated by sage. I know there are simpler ways to do this but I've wanted to do server-side work and get people talking with a server for a while now and this seems like a good introduction to it.
Any and all advice is appreciated, resources, help, etc.
There are certainly a number of people who have successfully set up their own Sage cell server, and as such things go I hear it is definitely doable. The previous "simple server" API is pretty much defunct and the Sage cell is a pretty reasonable way to do this. I don't see why you would need to have reinvent the wheel here, and asking on sage-support#googlegroups.com is a logical next step for you.

Web interface for a Python code [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
first, English is not my native language, so, forgive me for any mistake.
I don't want to make a evasive question, so i will detail my scenario and make my point below:
I need to make a Web interface to take a information from a html's form field. Specifically a text file. Then, i need to give this file as a paramater to a Python Script that will run on my Linux server (the same who was the Web interface). I have the script running okay, have the Web interface ready, but i didn't get the point to make the web stuff works.
I'm stuck on the part of "make the wweb form talks with python script".
I tried some linux commands and some tips found on my research, but didn't work.
The goal of this thing, is to not send the Python code to end-user. So, the clients will "use" the code from a web interface and will not see the Python code responsable for make the hole stuff works.
Does anyone ever seen this kind of implementation?? Any help or information will be nice ! Tks a lot !
You should probably start with this page from the Python documentation - http://docs.python.org/howto/webservers.html. This may give you some ideas about how this works, and depending on what you need you may then continue reading about more detailed topics. Solution will depend on your plans for further development (will you extend the logic of this application? will you connect to the DB, etc.), security concerns, etc.
For only the case you define, it sounds like some simple solution will work for you, like having a simple CGI script ( http://docs.python.org/library/cgi.html), and you probably don't (yet) need anything powerful like Django or TurboGears.
For CGI to work, you will need to configure Apache web server, enable CGI for it, and then implement the CGI script utilizing your already implemented program.
You may check on the web how to do each of those steps. For example, right here, on stackoverflow: How do you set up Python scripts to work in Apache 2.0?
In your CGI script, you will need to implement some logic which will allow users to upload files to your server. You may check this page for that: http://code.activestate.com/recipes/273844-minimal-http-upload-cgi/
Finally, if with time you plan to further develop your application, you may want to look to something like Django or TurboGears. The more complex your application is - the better it is to use some web framework. You will probably spend more time studying those, but in the end you get much more power with them, and you get the code which is much more easier to maintain compared to CGI scripts. But, just as I said - it depends on your needs. (Although studying them is a good idea anyway ;) )

Trace speed issues in python running on google app engine

I'm new to python, django and google app engine. All great tools and have been enjoying working with them.
However, on my production site its taking 4 seconds to load a webpage, which I think is horrible and needs to be less than a second. I've also verified the long amount of time is in the request to the get the page, not downloading any media files.
First thought is yes, it still has the first start issues any gae app would, I'm not trying to fix those. I understand that the first time you hit your website after uploading a new version it needs to load up the code for the first time. Additionally, if your site isn't visited often then this happens alot. All of this I'm aware of and not trying get more info on.
My site is relatively simple and its not loading big data or displaying complicated designs. And on my localhost it runs extremely fast. I should also point out that I'm using Django nonrel, which is a great tool that allows me to develop quickly with django on gae: http://www.allbuttonspressed.com/projects/django-nonrel
The problem I'm having is that its taking way to long for pages to load in production and I need to get to the bottom of it. I'm sure I've coded something poorly, but I'm not familiar enough with python and gae to know the best debugging practices, especially if it only seems to have issues in production.
So for a newbie python / django / google app engine developer, how do I quickly and easily find what functions are taking so much time?
Use appstats.

Categories