0

We have made a code for webpage made of flask, and access it locally by inputting the IP address of the raspberry pi e.g(192.168.0.1:5000) in the browser. In reference with (https://diyhacking.com/raspberry-pi-web-server/#comment-4651), can we proceed to setting up the static ip(STEP 4: Give your Raspberry Pi a static IP address, in the URL) and setup a dynamic ip without installing Apache?

2 Answers 2

1

If you can always reach your Pi on your local network by visiting 192.168.0.1:5000 then the Pi already has a static local IP address. If that IP address changes occasionally then the IP address is being assigned by Dynamic Host Configuration Protocol (DHCP), controlled by your router. You want to make sure the Pi's local IP address is static before continuing.

With regard to installing Apache, Flask's documentation currently states:

While lightweight and easy to use, Flask’s built-in server is not suitable for production as it doesn’t scale well and by default serves only one request at a time.

If you can live with only serving one request at a time and don't care too much about security you can press ahead and open your Pi up to the big bad world. I would recommend, in the strongest possible terms, that you don't do this and use a recognised server package such as Apache. It'll work better in the long run and should give you much more control over what's happening with your site(s). The deployment documentation has a list of viable options and accompanying instructions.

-1

If you don't like the idea of installing apache, you could also consider using something like Heroku or PythonAnywhere to host your site. Both have some free options for small web applications and there are tutorials available to get you started.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.