Hi I'm trying to write a code for a web server in python with flask. This is what I have so far
from flask import Flask
app = Flask(__name__)
@app.route('/') #first endpoint i.e. "http://localhost/"
def index():
return 'hello' #return data in string
if __name__ == '__main__':
app.run(debug=True)
After running the code, I'm given a address to the web with the text hello. The problem is that this only works with my computer that is running the code. If I try to enter this address into my phone's browser it will show up as connection refused. How do I fix this so that I can get a Python Web Server with a address that will show 'hello' on any device.
Flask runs on a Local Server on a port given port. The reason you cannot open it in your mobile browser is because it is not deployed on the web, in order to display that code on your mobile device you have to be connected on the same network i.e the machine you are running the code on (in which you made that local server) and that device you want that code to display in.
Hi I'm trying to write a code for a web server in python with flask. This...
Hi, I am current using flask to run a python web application that currently just allows users to access a video camera on a localhost. As of now, I need to type python main.py to actually run the project and turn on the localhost. What I want to do is, be able to click a button in HTML, through google chrome, and just run the webcam like that. To sum it up, I want to click a simple button and...
Project Description In this project, you will be developing a multithreaded Web server and a simple web client. The Web server and Web client communicate using a text-based protocol called HTTP (Hypertext Transfer Protocol). Requirements for the Web server The server is able to handle multiple requests concurrently. This means the implementation is multithreaded. In the main thread, the server listens to a specified port, e.g., 8080. Upon receiving an HTTP request, the server sets up a TCP connection to...
This is Python 2.7 I'm trying to make my output look like this: ['weather: (55, 75, 80)', 'windspeed: 10', 'humidity: (35, 40)'] This is what it looks like now ['weather: (55, 75, 80)'] ['windspeed: 10'] ['humidity: (35, 40)'] ________________________________________________________________________________________________________________________________ This is how my code looks: def weather_strings(dictionary): 1_list = [ ] for key in dictionary.keys(): the_keys = str(key) val = str(dictionary[key]) print 1_list + [the_keys + ': ' + val] def main(): """This function prints the above functions""" test_dict =...
AND logic gate simulation in Python: Please fix the code below so that it efficiently performs the operation of the AND logic gate in Python. (Leave comments in the edited code about what you changed) #if both values are 1, return true, other wise return false print ("Logic Gate Simulation: AND gate") def AND(x, y): if x == True and y == True: return True else: return False def main(): x = bool(input("Please...
Hi so I want to run a Python script (in this example it can be something as simple as print hello world) when a button on a Python Flask Server is pressed. In other words when I enter the web server, there will be a button and pressing it will launch the python script on my computer. Thank you
Me and my friend are developing a web-app in Python + Flask + PostgreSQL. We have been working on it for the past few months and have developed a lot of schema/use-cases specific to Python + Flask + PostgreSQL. Now, all of a sudden, we plan to move to another NoSQL database (Neo4j) because it somehow fits better to what the core of our web-app is going to be. Python supports Neo4j through embedded/rest api bindings, but uses a technology...
How do I make my code print out the text in the ServiceNotifier class? Python Code: class ServiceNotifier: #Subject responsible for notifying registered observer objects Observer = [Email, SMS, Phone] def attach(self): #add new observer Observer.append(insertnewobserverhere) def dettach(self): #remove an observer Observer.pop(insertnewobserverhere) def servicenotifier(self): for observers in Observer: print("Due to the forecast for tomorrow, all university and campus operations will be closed.") ...
I need help with my python class. thanks! Question 12 Code Example 4-4 main program: import arithmetic as a def multiply(num1, num2): product = num1 * num2 result = a.add(product, product) return result def main(): num1 = 4 num2 = 3 answer = multiply(num1, num2) print("The answer is", answer) if __name__ == "__main__": main() arithmetic module: def add(x, y): z = x + y return z Refer to Code...
Hello, In Python, I am trying to create a function that will return the domain name from any inputted email address. For example, my input of john@domainname.com would return just the domainname. It needs to be done using regular expressions and the map function. I'm still stuck on trying to get the correct parameters for regular expression and also what is throwing it off. Thank you for your help! I am currently working with a list of different email addresses...
need help to complete the task: app.py is the Python server-side application. It includes a class for representing the list of albums. You need to complete the missing parts such that it loads data from the data/albums.txt and data/tracks.txt files. You can decide what internal data structure you want to use for storing the data. It is already implemented that a single instance of the Albums class is used, so that loading from the files happens only once (and not...