loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.2110861952541483","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"ZnJvbSBmbGFzayBpbXBvcnQgRmxhc2ssIHNlc3Npb24KYXBwID0gRmxhc2soX19uYW1lX18pCiMgQWRkIHRoZXNlIGV4dHJhIHR3byBsaW5lcwphcHAuc2VjcmV0X2tleSA9ICdzM2NyM3QnCmFwcC5jb25maWdbJ1NFU1NJT05fVFlQRSddID0gJ2ZpbGVzeXN0ZW0nCgpAYXBwLnJvdXRlKCcvPGludDp4PicpCmRlZiBjb3VudCh4KToKICAjIFNlZSBpZiB3ZSBhbHJlYWR5IGluc3RhbnRpYXRlZCB0aGUgbGlzdAogIHMgPSBzZXNzaW9uLmdldCgnc3VtJywgTm9uZSkKICBpZiBub3QgczoKICAgICMgSWYgaXQncyBub3QgdGhlcmUsIGFkZCBvdXIgZmlyc3QgaXRlbS4KICAgIHNlc3Npb25bJ3N1bSddID0geAogIGVsc2U6CiAgICAjIElmIGl0J3MgdGhlcmUsIGFkZCB0aGUgY3VycmVudCBudW1iZXIKICAgc2Vzc2lvblsnc3VtJ10rPXgKICAgIyBEaXNwbGF5IGN1cnJlbnQgY291bnQKICByZXR1cm4gc3RyKHNlc3Npb25bJ3N1bSddKQoKCkBhcHAucm91dGUoJy8nKQpkZWYgaG9tZSgpOgogIHJldHVybiAnT3BlbiB0aGlzIHBhZ2UgYW5kIGdvIHRvIC81IG9yIHNvbWUgb3RoZXIgbnVtYmVyJwoKaWYgX19uYW1lX18gPT0gJ19fbWFpbl9fJzoKICBhcHAucnVuKGhvc3Q9JzAuMC4wLjAnKQo="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from flask import Flask, session
app = Flask(__name__)
# Add these extra two lines
app.secret_key = 's3cr3t'
app.config['SESSION_TYPE'] = 'filesystem'

@app.route('/<int:x>')
def count(x):
  # See if we already instantiated the list
  s = session.get('sum', None)
  if not s:
    # If it's not there, add our first item.
    session['sum'] = x
  else:
    # If it's there, add the current number
   session['sum']+=x
   # Display current count
  return str(session['sum'])


@app.route('/')
def home():
  return 'Open this page and go to /5 or some other number'

if __name__ == '__main__':
  app.run(host='0.0.0.0')