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

404 returned when registering with another node #34

Closed
hanglearning opened this issue Apr 1, 2020 · 4 comments
Closed

404 returned when registering with another node #34

hanglearning opened this issue Apr 1, 2020 · 4 comments

Comments

@hanglearning
Copy link

First of all thanks satwikkansal for an awesome blockchain python tutorial!

When I tried to register a new node with an existing node by using these commands

$ flask run --port 8001

(in  a new terminal tab)$  curl -X POST \
  http://127.0.0.1:8001/register_with \
  -H 'Content-Type: application/json' \
  -d '{"node_address": "http://127.0.0.1:8000"}'

I got this returned back -

<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>

I checked the tab with port 8001, and I found port 8001 does receive this request, but also it shows a 404 error:
127.0.0.1 - - [31/Mar/2020 23:14:21] "POST /register_with HTTP/1.1" 404 -

Could anyone help me overcome this issue? Thanks!

@satwikkansal
Copy link
Owner

It seems like your port 8000 is running the application and not the node_server

@hanglearning
Copy link
Author

Hi satwikkansal, thanks a lot for your reply!

No, I did run node_server on port 8000. I run the application on port 5000 by the default config. I didn't change any code and followed your tutorial blog. I just did these to reproduce the issue:

In my first tab, I run node_server on port 8000
Screen Shot 2020-04-02 at 11 38 41 AM

Then in my second tab, I run the app
Screen Shot 2020-04-02 at 11 38 59 AM

In my third tab, I run another node_server on port 8001
Screen Shot 2020-04-02 at 11 39 06 AM

In my fourth tab, I tried to register 8001 with 8000 and got 404
Screen Shot 2020-04-02 at 11 39 26 AM

Come back to the third tab, there's an extra line showing 404 error as well
Screen Shot 2020-04-02 at 11 39 37 AM

The first and second tabs didn't prompt any extra information.

Please let me know where I could do it wrong. I really appreciate your help! 😊

@satwikkansal
Copy link
Owner

You thrid tab is not serving node_server, compare the logs with the second tab.

You need to export the FLASK_APP environment variable in the third tab as well.

@hanglearning
Copy link
Author

Oh correct! Thank you! Turns out it's my false assumption about how flask app runs! Sorry to bother you for this naive question.

Thanks again😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants