Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about the serve directory #1091

Open
WaterEmissary opened this issue Dec 17, 2024 · 0 comments
Open

Questions about the serve directory #1091

WaterEmissary opened this issue Dec 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@WaterEmissary
Copy link

WaterEmissary commented Dec 17, 2024

Bug Description

I wasn't sure if this was the right way to use it, but it exceeded my expectations

`app.serve_directory(
route='/',
directory_path=os.path.join(os.getcwd(), "templates"),
index_file='index.html'
)

@app.get('/myget')
def get(request):
return "get"

@app.post('/mypost')
def post(request):
return request.json()`

When I set route = ‘/’, I can go directly to my web page at http://127.0.0.1:8080. But all requests except GET will return 405. Request did not meet this resource's requirements.

app.serve_directory( route='/index', directory_path=os.path.join(os.getcwd(), "templates"), index_file='index.html' )
When I changed route to any other url, all methods went back to normal.
I'm not sure if I'm using it the wrong way or if there's a bug in the serve_directory.
also It works fine as long as you don't set route to '/', but most of the time we want to integrate the front end into the python web and be accessible directly from the root directory

QQ20241217-200417

Steps to Reproduce

No response

Your operating system

None

Your Python version (python --version)

None

Your Robyn version

None

Additional Info

No response

@WaterEmissary WaterEmissary added the bug Something isn't working label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant