Can you store files on Replit?

**I’m building a Python/Flask app that generates a docx document, stores it and will then send it to an external API. When I run the app before deployment, it works fine and I can see the new document. However, when I deploy it, the docx files is no longer stored.

Does Replit allow apps to create and store files like this?**

import logging
from flask import Flask, request
import contract
import extractions
import json

# webhook =

# initialize flask app
app = Flask(__name__)

def home():
  # Simple route to verify the app is running
  return "Webhook listener is running."

# this is where webhook data is received
@app.route('/webhook', methods=['POST'])
def webhook_listener():
  if request.method == 'POST':
    # check if the incoming request is JSON
    if request.is_json:
      # parse the JSON data from the request
      form_data = json.loads(request.get_json()['rawRequest'])
      # fallback for form-encoded data
      form_data = json.loads(request.form['rawRequest'])

    #"Received data: {form_data}")
    print(f"Received data: {form_data}")
    # create empty dictionary to store script output
    doc_data = {}
    # get form response data and store in doc_data

    filename = contract.filename(doc_data)

    doc_data.update(extractions.signature(form_data, filename))

    # generate string to name new file and insert data into contract
    contract.contract_filler(doc_data, filename)

    # return an empty response indicating success
    return '', 204

  return "done"

if __name__ == "__main__":"", port=8080, debug=True)

Not in deployments, no. Replit is currently working on object storage, though. Some people were offered to join the beta.


This is not the answer I was hoping for, but you saved me countless hours of testing thinking I was doing something wrong.
Thank you.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.