Run Flask application with poetry

I locally developed an application in python / flask and everything works correctly.
I imported the project from GitHub and when i RUN it get:

Serving Flask app 'app'
 * Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 118-152-027

anyway i am not able to understand how to test it

so i tried to deploy it and when i try i get:

2024-01-21T21:06:16Z info: Deployment: 2fed247c-cc06-44c7-8cdc-f7bd3c966bd7
2024-01-21T21:06:16Z info: Build: 9e18f5e1-7827-475f-91e8-9ae1d7ab3fdc
2024-01-21T21:06:16Z info: Connecting to builder
2024-01-21T21:06:18Z info: Builder connected
2024-01-21T21:06:19Z info: Installing packages
2024-01-21T21:06:19Z info: Skipping Build as no Build command set
2024-01-21T21:06:19Z info: Pushing pid1 binary layer...
2024-01-21T21:06:21Z info: Created pid1 binary layer
2024-01-21T21:06:25Z info: Skipping Python layer creation
2024-01-21T21:06:25Z info: Pushing Repl layer...
2024-01-21T21:06:25Z info: Retrieved cached nix layer
2024-01-21T21:06:25Z info: Created hosting layer
2024-01-21T21:07:11Z info: Created Repl layer
2024-01-21T21:07:12Z info: Pushed image manifest
2024-01-21T21:07:12Z info: Pushed soci index manifest
2024-01-21T21:07:18Z info: Creating Autoscale service
2024-01-21T21:07:58Z error: The deployment failed to initialize due to a configuration or code error. Check the logs tab for more information. For additional support, please post on https://ask.replit.com/c/help/13 and a staff member will take a look.

there’s no log generated and i can’t understand.

Thanks

stefano

:wave: Welcome @Prof_StefanoStefano!

Can you share your configuration settings?

Here’s my .replit file:

entrypoint = "app.py"
modules = ["python-3.10:v18-20230807-322e88b"]

hidden = [".pythonlibs"]

[nix]
channel = "stable-23_05"

[unitTest]
language = "python3"

[deployment]
run = ["python3", "app.py"]
deploymentTarget = "cloudrun"

Here’s the replit.nix

{pkgs}: {
  deps = [
    pkgs.bash
    pkgs.tk
    pkgs.tcl
    pkgs.qhull
    pkgs.pkg-config
    pkgs.gtk3
    pkgs.gobject-introspection
    pkgs.ghostscript
    pkgs.freetype
    pkgs.ffmpeg-full
    pkgs.cairo
    pkgs.rustc
    pkgs.libiconv
    pkgs.cargo
  ];
}

Here’s the pyproject.toml:

[tool.poetry]
name = "la2i-flask"
version = "0.1.0"
description = ""
authors = ["paisleypark <paisleypark@outlook.it>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
flask = "^3.0.0"
passlib = "^1.7.4"
jwt = "^1.3.1"
bcrypt = "^4.1.2"
pyjwt = "^2.8.0"
flask-session = "^0.5.0"
python-dotenv = "^1.0.0"
langchain = "^0.0.354"
youtube-transcript-api = "^0.6.2"
openai = "^1.6.1"
networkx = "^3.2.1"
matplotlib = "^3.8.2"
fitz = "^0.0.1.dev2"
frontend = "^0.0.3"
tools = "^0.1.9"
pdfplumber = "^0.10.3"
chromadb = "^0.4.22"
tiktoken = "^0.5.2"
faiss-cpu = "^1.7.4"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

just let me know if you need something else.

Thanks

stefano

That’s not what I meant.

When you go to create a deployment, you set the run command and optionally the build command.

Can you send a screenshot of that screen?

Thanks, i re-deployed and it worked. i found the issue in the “run”, my parameter was wrong (it was main.py instead of app.py).

Thanks for your fast support. Anyway, how can i test my application without deploying it? is it possible using the RUN?

thanks!

stefano

Yes. After pressing the run button, the Webview should automatically pop up, and there should be an arrow pointing out of a box icon. Clicking it will open your website in a new tab so you can test.

Unfortunately no one webview appears:

Try looking for the “Webview” option under Tools in the sidebar

ok found the solution:

app.run(“0.0.0.0”)

if i have this the webview automatically appears!

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