All Questions
2,383
questions
129
votes
2
answers
154k
views
How to measure server response time for Python requests POST-request
I create POST requests with requests as follows, with a specified timeout threshold:
response = requests.post(url, data=post_fields, timeout=timeout)
However, to determine a "good" threshold,...
70
votes
5
answers
53k
views
ipython server can't launch: No module named notebook.notebookapp
I've been trying to setup an ipython server following several tutorials (since none was exactly my case). A couple days ago, I did manage to get it to the point where it was launching but then was not ...
61
votes
11
answers
158k
views
django development server, how to stop it when it run in background?
I use a Cloud server to test my django small project, I type in manage.py runserver and then I log out my cloud server, I can visit my site normally, but when I reload my cloud server, I don't know ...
58
votes
1
answer
165k
views
What does "app.run(host='0.0.0.0') " mean in Flask [duplicate]
I am reading the Flask documentation. I was told that with app.run(host='0.0.0.0'), I could make the server publicly available.
What does it mean ? How can I visit the server in another computer (...
42
votes
8
answers
71k
views
Install Anaconda on Ubuntu (or Linux) via command line
I would like to install Anaconda on a remote server.
The server is running Ubuntu 12.04.
I only have access to this server via SSH.
How can I install Anaconda via the command line?
27
votes
10
answers
59k
views
cannot quit jupyter notebook server running
I am using Jupyter Notebook for a project. Since I ssh into a linux cluster at work I use
ssh -Y -L 8000:localhost:8888 user@host
Then I start the notebook with jupyter notebook --no-browser & ...
26
votes
4
answers
29k
views
How to increase message size in grpc using python
I am using grpc for message passing and am testing a simple server and client. When my message size goes over the limit, I get this error.
grpc._channel._Rendezvous: <_Rendezvous of RPC that ...
26
votes
1
answer
3k
views
Locust.io Load Testing getting "Connection aborted BadStatusLine" Errors
I'm using Locust.io to load test an application. I will get a random error that I am unable to pinpoint the problem:
1)
ConnectionError(ProtocolError(\'Connection aborted.\', BadStatusLine("\'\'&...
25
votes
9
answers
34k
views
Extract domain name from URL in Python
I am tring to extract the domain names out of a list of URLs. Just like in
https://stackoverflow.com/questions/18331948/extract-domain-name-from-the-url
My problem is that the URLs can be about ...
25
votes
5
answers
33k
views
What is the easiest way to run python scripts in a cloud server?
I have a web crawling python script that takes hours to complete, and is infeasible to run in its entirety on my local machine. Is there a convenient way to deploy this to a simple web server? The ...
22
votes
3
answers
63k
views
ModuleNotFoundError: No module named 'fcntl' [duplicate]
for flask application run using gunicorn
$ pip install gunicorn
$ gunicorn --bind 0.0.0.0:8000 app:app
getting error
Traceback (most recent call last):
File "C:\Users\shubham\AppData\Local\...
21
votes
1
answer
2k
views
Bokeh server callback initiated from Flask application
I am building an app using the Flask-AppBuilder framework, and have successfully embedded a bokeh plot using autoload_server to insert the script src into my html template. At the moment, I have a ...
20
votes
2
answers
45k
views
Run Spyder /Python on remote server
So there are variants of this question - but none quite hit the nail on the head.
I want to run spyder and do interactive analysis on a server. I have two servers , neither have spyder. They both have ...
19
votes
3
answers
142k
views
Python, How to Send data over TCP
I need to create a simple server that listens for TCP connections.
If it receives text on<EOF> or off<EOF> then it sends (echo) back success. The receiving part is working, but now i need ...
16
votes
2
answers
38k
views
How to run a server in python
How to run a server in python?
I already have tried:
python -m SimpleHTTPServer
python -m HTTPServer
but its says to me:
invalid syntax
Can someone help me?
Thanks!
16
votes
3
answers
9k
views
Gunicorn + nginx - Ignoring EPIPE
I have an nginx-gunicorn-flask setup running on google compute
and I keep getting the following from gunicorn:
[2019-04-19 20:50:49 +0000] [3345] [DEBUG] POST /
[2019-04-19 20:50:49 +0000] [3345] [...
15
votes
2
answers
24k
views
How to close socket connection on Ctrl-C in a python programme
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
any_connection = False
while True:
try:
conn, addr = s.accept()
data = conn.recv(1024)
...
15
votes
3
answers
39k
views
Error with gunicorn server start
On an external server, I tried to run the command:
gunicorn --bind 0.0.0.0:8000 jeremiesblog.wsgi:application
I got this error:
[2017-01-29 15:08:02 +0000] [19640] [INFO] Starting gunicorn 19.4.5
[...
15
votes
2
answers
568
views
Robust endless loop for server written in Python
I write a server which handles events and uncaught exceptions during handling the event must not terminate the server.
The server is a single non-threaded python process.
I want to terminate on ...
14
votes
3
answers
28k
views
Cannot connect to python -m SimpleHTTPServer server
this this probably a very simple question, but I haven't been able to find an answer anywhere. On the online articles about it, they didn't show the exact process to share a directory using ...
14
votes
2
answers
74k
views
The requested address is not valid in its context error
I was following a tutorial called "Black Hat Python" and got a "the requested address is not valid in its context" error. I'm Python IDE version: 2.7.12
This is my code:
import socket
import ...
14
votes
2
answers
28k
views
Reload python flask server by function
I'm writing a python/flask application and would like to add the functionality of reloading the server.
I'm currently running the server with the following option
app.run(debug=True)
which results ...
13
votes
2
answers
18k
views
SimpleHTTPServer not found python3
I'm trying to write a simple server in python. So after watching tutorial, I'm trying to import a few modules.
from http.server import HTTPServer
from http.server import SimpleHTTPServer
As the doc ...
13
votes
4
answers
28k
views
ImportError: No module named 'appdirs'
I'm trying to get a program called hangoutsbot
to work on my linux server. I'm currently using a digital ocean server. However, every time I try to run the script it gives me an error that says:
...
12
votes
4
answers
20k
views
Serve directory in Python 3
I've got this basic python3 server but can't figure out how to serve a directory.
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
print(self.path)
...
12
votes
3
answers
59k
views
Simple Python server to process GET and POST requests with JSON
I'm trying to create a simple Python server in order to test my frontend. It should be able to handle GET and POST requests. The data should be always in JSON format until they are translated to HTTP ...
12
votes
3
answers
19k
views
Python -m http.server 443 -- with SSL?
Is it possible to create a temporary Python3 HTTP server with an SSL certificate? For example:
$ python3 -m http.server 443 --certificate /path/to/cert
12
votes
3
answers
15k
views
Static files not found with webpack and django
The problem is that I can get access to the app on the browser but not static assets (js, jsx and images).
Technologies I am using:
django-webpack-loader 0.2.4
React 0.14
Django 1.8.5
Python 2.7
...
11
votes
3
answers
78k
views
flask - Display database from python to html
I have code like this to retrieve data from database and I want to display it in html.
This is app.py
@app.route('/news')
def news():
import pymysql
import re
host='localhost'
user =...
11
votes
1
answer
16k
views
Django is synchronous or asynchronous?
Django is synchronous or asynchronous?
I want to know that the Django Framework is Synchronous or Asynchronous.
I have heard about the interview problems they ask about the framework you are using is ...
11
votes
5
answers
33k
views
How to shut down python server
Used this code to run a python server:
import os
from http.server import SimpleHTTPRequestHandler, HTTPServer ...
10
votes
1
answer
3k
views
NGINX + Flask, without Gunicorn?
I am new to this, but by comparing the code of gunicorn with flask/werkzeug, I fail to understand the real benefit of inserting gunicorn between nginx and flask. Would like to get some expert opinions ...
10
votes
1
answer
1k
views
How does distributed tensorflow work ? (Issue with tf.train.Server)
I have some troubles with the new option of tensorflow that allows us to run distributed tensorflow.
I just would like to run 2 tf.constant with 2 tasks but my code never ends. it looks like that :
...
8
votes
2
answers
3k
views
Start http web server then open browser
I'm trying to start a simple HTTP server then open it in the default browser. I don't know what I'm doing wrong, it's either not starting the server at all, or it's stopping as soon as it gets to the ...
8
votes
1
answer
9k
views
ValueError: jpeg is required unless explicitly disabled using --disable-jpeg, aborting
I try to install reddit on a 12.04 ubuntu server but I get an error
Please see the lines from terminal below. Please help me to fix it.
I get this error after the ff line "sudo python setup.py ...
8
votes
4
answers
51k
views
How do I make a list of all members in a discord server using discord.py?
I am writing a discord bot and I came across this error when trying to pull all the members from a server with the command !members in on_message event:
elif message.content.startswith('!members'):
...
8
votes
4
answers
30k
views
Reading from asyncio StreamReader
I am trying to extend the python asyncio HTTP server example that uses a streaming reader/writer (code). If I understand it correctly, the example handler read 100 bytes from the reader and echoes it ...
8
votes
4
answers
21k
views
HTTP Server Not Working (Python)
This is my first time trying to get HTTP servers working on my computer, so I have run into a few technical difficulties.
I am using Python to develop the server, and I can access it on my localhost. ...
8
votes
3
answers
563
views
How to write an array tag in a VARIANT structure on an OpenOPC server
I'm trying to communicate with an OPC DA server and need to write in a tag which is in an array format. We can connect with a simulation server, read tags (int, real, array) and write tags (int, real, ...
8
votes
2
answers
7k
views
PyCUDA context error when using Flask
I am using the PyCUDA to implement the smooth_local_affine as shown here. It works well when I simply run the program on linux. But when I tried to import it under Flask context:
from ...
8
votes
2
answers
3k
views
How to make centralized Login server with Django?
Where I work currently there are many Django projects, each running on their own VPS, and each is running under their own subdomain (foo.example.com, bar.example.com, ...) as shown in the following ...
8
votes
0
answers
6k
views
How to start Gunicorn server from python script
I've built a Django project that works, even after I freeze it using Cx_Freeze and Py2exe.
Now I'm trying to set up the project for distribution, which requires a real webserver. I'm going for ...
7
votes
1
answer
7k
views
@method_decorator(csrf_exempt) NameError: name 'method_decorator' is not defined
I was following the following guide (https://abhaykashyap.com/blog/post/tutorial-how-build-facebook-messenger-bot-using-django-ngrok) on how to create a chatbot, until the part where I updated the ...
7
votes
2
answers
40k
views
How to send a message from client to server in python
I'm reading two programs in Python 2.7.10 with client and server. How can I modify these programs in order to send a message from client to server?
server.py:
#!/usr/bin/python # This is ...
7
votes
1
answer
20k
views
How to create a very simple DNS server using Python?
I just want to create a DNS Server who listen to requests and always return the same specific ip. I'm using Python....
7
votes
2
answers
6k
views
Python 3; Websockets Server & HTTP Server - run_forever & serve_forever
I am trying to run a websockets server and an http server in the same python application. It looks like I'm trying to run two forever loops and the 2nd loop is not getting activated. Any advice on how ...
7
votes
1
answer
5k
views
What is "Application startup file" option on Cpanel python application?
I'm trying to deploy my django project to my host using cpanel, but there are some new options in Create python applications tab. What should i set for the following items:
"Application startup file"
...
7
votes
1
answer
14k
views
How does python's SimpleHTTPServer do_GET and do_POST functions work?
I've created the following little HTTP server for learning purposes:
import SimpleHTTPServer
import SocketServer
class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):...
7
votes
2
answers
22k
views
How to set a global variable in python flask? [duplicate]
I would like to set a global variable and use it as a trigger of various functions. Each user has a separate global variable. This is used to keep track of previous message data and proceed a ...
7
votes
3
answers
2k
views
How to run the Python program in the background in Ubuntu server
I have a python script. Script have selenium with Chrome and go to a website, take data and put in CSV file.
This is a very long work.
I put the script on the server. And run. All work.
But I need ...