plotly dash webpage works on Raspberry Pi BUT can't access it over a LAN - plotly-dash

I have started playing with Dash which is EXCELLENT for me as I don't want to be a web coder. the web page is GREAT on host machine localhost 127.0.0.1:8050
BUT I cannot get at the web page using 192.168.1.216:8050 on the same LAN?
I checked the ports on the raspberry pi and it's listening on 8050
also I am logged in as the same user on both the remote and the hosting machines.
is there something I am missing here? Here is the print out
Running on http://192.168.1.202:8050/
Debugger PIN: 086-877-772
* Serving Flask app "5 26 20 dash datatable drop select csv" (lazy loading)
* Environment: production
[31m WARNING: This is a development server. Do not use it in a production deployment.[0m
[2m Use a production WSGI server instead.[0m
* Debug mode: on

Dash class uses 127.0.0.1 as a default IP address. Did you set the host parameter in the run_server() method?
if __name__ == '__main__':
app.run_server(debug=True, host="192.168.1.216", port=8050)

Related

Exposing React App with Local MySQL Database to Internet Using Ngrok

I am very new to ngrok, so please bear with me.
I have a very simple React test app that is using Django as a server and local MySQL database. Django pulls/inserts some info from the local database and sends to the frontend. Everything works well.
What I'm trying to do is expose this local app to public Internet. I have successfully installed and configured Ngrok, established a tunnel and was able to view the app on a different computer through the address generated by Ngrok. The problem is, I was able to see only the UI that is not related to the database. All data that React pulls from the local database, was not visible when I used a different computer. My question is, is there a way to use the same app through Ngrok and get the same data from the local MySQL database that I see when I just run the app locally? I know that I can create another tunnel that exposes the port MySQL or Django are running on (3306 and 8000 respectively) but if I do this, how would I access the data through Ngrok? Would I need to change anything in React code?
Thank you in advance!

Flask access from different devices

Is there a way to generate a specific IP address or make a specific site of flask http://127.0.0.1:5000/ site which runs locally, to access the web-app made using flask from different device as by default it runs locally and under http://127.0.0.1:5000/ but,i want to access it from different devices.If,there's a way please help
refer first to this doc (section Externally Visible Server) on how to expose your local Flask app to make it accessible from trusted devices in your network for testing purposes.
$(venv) flask run --host=0.0.0.0
or in your app.py
from flask import Flask
[..]
app = Flask(__name__)
[..]
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000, debug=True)
and then :
$(venv) python app.py
but if it happens and you got this error dial tcp 0.0.0.0:5000: connect: connection refused then try to use the local ip address (192.168.x.y instead of 0.0.0.0) of the machine hosting your Flask app. you may find this thread usefull
Instead of localhost (127.0.0.1), you need to type your router's public IP. If you do not already know it, you can retrieve it by typing ipconfig (for Windows) or ifconfig (for Linux) in the command line.
You also need to disable your firewall or add an inbound rule for the port used by your server (e.g. 5000).
You can access your server on devices in the same Network / Wifi with your private IP address and the port.
On Mac OS option + click on Wifi in your Taskbar.
On linux:
> ifconfig

Arduino + Sim900 + MySql connection problem

I'm doing a project where I must do a query to a mysql server with the Sim900 module throught Arduino. Let me explain what I have, so that you can help me:
Arduino Uno (original version)
Sim900 module (https://www.amazon.es/gp/product/B07FS34P84/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1)
5V/2A Power Supply Adapter for Sim900 (https://www.amazon.es/gp/product/B07DX11WJJ/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1)
Windows Server 2012 with Static Ip (xxx.xxx.xx.xx), with a MySql Server that allows external connections (with an extern computer or smartphone, I can access the db)
First of all, I tried to do a query with the GChrome, like http://xxx.xx.xxx.xxx:3306/connect.php but this didn't worked. Then, I downloaded XAMPP and connected Apache and MySql. At that time, I writted in the Chrome search bar: http://localhost/connect.php and it said: Connected successfully so, at that moment I knew that I connected to the db.
So, I tried to connect with AT commands: First of all, I connected with the APN
AT+CSTT= "airtelnet.es", "vodafone", "vodafone"
and then I tried to connect with TCP to the server
AT+CIPSTART="TCP","xxx.xx.xxx.xxx","3306"
At this moment, the Serial Monitor gave me some errors and special characters.
Can someone help me with this?, what am I doing wrong?
Not sure what you want to do. Are you using sim900 for gprs as internet connection for Arduino? Do your arduino has shield for LAN cable.
If so, your xampp mysql should work as API server. Arduino will call url to send data, mysql is just internal job of server, no directly connection with arduino.

Apache2 Linux GoDaddy

Hi I'm new to website development and I am trying to configure a number of websites from my home based server using Apache2 and Linux Mint.
I have setup three new websites in addition to the 000-default page.I have created the Virtual Host config files in sites-available and have added the sites to Host.conf. Internally(on the server in a browser) they are all working fine - I can access all four sites using localhost or the URLs I've configured them with -tested with and without the www. prefix and all seems fine. The four sites are just basic HTML scripts with different headers and different one line body.
I've added Listen 8090 to Listen 80 on my ports.conf file and have opened port 80 and 8090 on my firewall and have updated Port Forwarding on my router and tested they are open using PortCheckTool. The two ports are open and every other port is locked out so that seems good too.
I've tried to configure a GoDaddy domain name to direct activity to one of these sites. The domain name that works internally (on the server in a browser) is the same as my GoDaddy domain name I've bought. I've been into my GoDaddy account and pointed this domain at my external IP address (tried also adding port to forwarding 8090 as well as leaving port number as default). However when I access this domain from my mobile phone using 3G with WIFI turned off I just get sent to the 000-default homepage.Same using default Port 80 and with Port Forwarding to 8090. I have script for both 80 and 8090 in my site config files in sites-available directory.
So the connection is getting to the server, ports are OK, it's just that apache2 doesn't redirect the GoDaddy traffic but redirects fine locally on the server for the same site!?
Any ideas what I am missing?
Any help would be much appreciated.
Thanks.

wordpress and node.js

Is it possible to install wordpress and node.js server on same server maschine and use wordpress mysql database also from node.js? Also is it possible to have noSql also installed on thah server to use with node.js? I want to use wordpress for frontend for my portal, but all asynchronous work to do with node.js and reading some data from wordpress mysql and writing some to noSql. Can someone please help me with steps how to achive this for testing purposes.
Thank you for your time and best regards!
If you're planning on using node for being accessed asynchronously by JavaScript that's being served by wordpress, then it will make your life considerably easier to have them running on the same host and port. What I've done in the past is set up the following:
Apache + PHP + Wordpress running on some port (8000?)
Node + npm + ever other package you'll want running on some other port (9000?)
HAProxy with some rules listening on port 80 which will decide based on the path which of the two servers to send requests to.
A normal installation of MySQL and whichever NoSQL DB you pick.
Recent versions of HAProxy can also terminate SSL, if you want to do the same with HTTPS on port 443.
Here's a sample HAProxy configuration:
defaults
log global
maxconn 4096
mode http
option http-server-close
timeout connect 5s
timeout client 30s
timeout server 30s
frontend public
# HTTP
bind :80
use_backend node if { path_beg /services }
# Everything else to Apache.
default_backend apache
backend node
server node1 127.0.0.1:9000
backend apache
server apache1 127.0.0.1:8000
Right, it's possible. The only catch is that Apache (running Wordpress) and Node.JS can't bind to the same port. In other words, you'll need to have Wordpress running on port 8080 and Node running on 80 (or other different ports).
Install Apache, PHP, Node, NPM, MySQL, NoSQL...
Configure Apache to listen on the desired port. (8080?)
Install Wordpress & Start Apache.
Start your Node application.
As for the precise steps involved to install those services, there are hundreds of guides online.
Yes it's possible, try express-php-fpm package.
You can use WordPress as backend only and Node.js for frontend.