Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon
with HyperThreading enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.
from sqlalchemy import create_engine, event, orm | |
from sqlalchemy.orm import sessionmaker | |
from sqlalchemy.orm.session import Session as SessionBase, object_session | |
from sqlalchemy.event.api import listen | |
# The following adds delete, insert, and update events after successful commits. | |
# SQLAlchemy provides only events after flushes, but not after commits. | |
# The classes are adapted from Flask-SQLAlchemy. | |
# see also https://stackoverflow.com/a/12026787/60982 |
Obviously for educative purposes only. | |
Furthermore, this DOESN'T activate BabelEdit permanently. | |
If you like the software, buy it, the devs deserve it. | |
Since I have no money to buy it, I discovered a workaround for unlimited trials. | |
It's quite a annoying workaround, but ... it works! | |
Firstly go to "c:\windows\system32\drivers\etc\" and open the "hosts" file in Notepad/Notepad++/VSCode/Sublime/Atom/whatever as admin (if you don't open it as admin, it won't let you save it). | |
Add this line at the end of the file: |
# Python == 3.6.2 | |
# bs4 == 4.6.0 | |
# The current version of BeautifulSoup's soup.prettify() function only allows for | |
# an indentation level = to 1 space. This is a simple, reliable way to allow for the use | |
# of any indentation level you wish. | |
import requests |
from flask import Flask, current_app | |
from blinker import Namespace | |
app = Flask(__name__) | |
app.secret_key = 'WOO' | |
my_signals = Namespace() | |
def moo_signal(app, message, **extra): |
from app.config import TWITTER_APP_KEY, TWITTER_APP_SECRET | |
twitter_oauth = oauth.remote_app( | |
'twitter', | |
consumer_key=TWITTER_APP_KEY, | |
consumer_secret=TWITTER_APP_SECRET, | |
base_url='https://api.twitter.com/1.1/', | |
request_token_url='https://api.twitter.com/oauth/request_token', |