{"id":18780,"date":"2022-11-01T23:05:08","date_gmt":"2022-11-01T17:35:08","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/"},"modified":"2022-11-01T23:05:08","modified_gmt":"2022-11-01T17:35:08","slug":"solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/","title":{"rendered":"[Solved] Connect a Flask webservice from a device which is not on the same network"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-38168254\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"38168254\" data-parentid=\"38167646\" data-score=\"1\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>Let A be the server you connecting to. Let B be the server you are connecting from, which, from what I gather, is sometimes localhost.<\/p>\n<h1>Why can&#8217;t B connect to A?<\/h1>\n<h2>1. Security Settings<\/h2>\n<p>The following is EC2-specific: You have to open up connections to specific IPs. Check your instance&#8217;s security settings. If you added a security group to your EC2 instance, add your IP or the IP of the server to it. Otherwise, make sure to whitelist the IP for B.<\/p>\n<h2>2. Port<\/h2>\n<p>I&#8217;m not entirely sure this is what you want, but if <em>everyone<\/em> should be able to access A, you should run the Flask app on port <code>8000<\/code>. If <em>only<\/em> B (and possibly your localhost) should be able to access A, then ignore this paragraph&#8230;<\/p>\n<h1>0.0.0.0 allows devices on the SAME network to connect<\/h1>\n<p>Automagically, yes. Incidentally, this is the IP you should be pointing to, for other servers to connect too. So in your case, point to <code>0.0.0.0<\/code> too.<\/p>\n<h1>Is Apache necessary?<\/h1>\n<p>No, Apache is <em>not<\/em> necessary. You can persist a Flask development server if you want. (a.k.a. You can use <code>python run.py<\/code> and just leave that process running for a &#8220;web service&#8221;) In this case specifically, you don&#8217;t need Apache to make this work. In the long-term, you will want Apache or Nginx to run your webservice however.<\/p>\n<p>Here&#8217;s a tutorial you can use to get Apache2 setup with Python. Just ignore the MySQL parts: <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-set-up-an-apache-mysql-and-python-lamp-server-without-frameworks-on-ubuntu-14-04\">https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-set-up-an-apache-mysql-and-python-lamp-server-without-frameworks-on-ubuntu-14-04<\/a><\/p>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">2<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved Connect a Flask webservice from a device which is not on the same network <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] Let A be the server you connecting to. Let B be the server you are connecting from, which, from what I gather, is sometimes localhost. Why can&#8217;t B connect to A? 1. Security Settings The following is EC2-specific: You have to open up connections to specific IPs. Check your instance&#8217;s security settings. If you &#8230; <a title=\"[Solved] Connect a Flask webservice from a device which is not on the same network\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/\" aria-label=\"More on [Solved] Connect a Flask webservice from a device which is not on the same network\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[1327,425,1679,349,1236],"class_list":["post-18780","post","type-post","status-publish","format-standard","hentry","category-solved","tag-amazon-web-services","tag-apache","tag-flask","tag-python","tag-web-services"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] Connect a Flask webservice from a device which is not on the same network - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] Connect a Flask webservice from a device which is not on the same network - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] Let A be the server you connecting to. Let B be the server you are connecting from, which, from what I gather, is sometimes localhost. Why can&#8217;t B connect to A? 1. Security Settings The following is EC2-specific: You have to open up connections to specific IPs. Check your instance&#8217;s security settings. If you ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-01T17:35:08+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] Connect a Flask webservice from a device which is not on the same network\",\"datePublished\":\"2022-11-01T17:35:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/\"},\"wordCount\":281,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"keywords\":[\"amazon-web-services\",\"apache\",\"flask\",\"python\",\"web-services\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/\",\"name\":\"[Solved] Connect a Flask webservice from a device which is not on the same network - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"datePublished\":\"2022-11-01T17:35:08+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] Connect a Flask webservice from a device which is not on the same network\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] Connect a Flask webservice from a device which is not on the same network - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] Connect a Flask webservice from a device which is not on the same network - JassWeb","og_description":"[ad_1] Let A be the server you connecting to. Let B be the server you are connecting from, which, from what I gather, is sometimes localhost. Why can&#8217;t B connect to A? 1. Security Settings The following is EC2-specific: You have to open up connections to specific IPs. Check your instance&#8217;s security settings. If you ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/","og_site_name":"JassWeb","article_published_time":"2022-11-01T17:35:08+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] Connect a Flask webservice from a device which is not on the same network","datePublished":"2022-11-01T17:35:08+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/"},"wordCount":281,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["amazon-web-services","apache","flask","python","web-services"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/","url":"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/","name":"[Solved] Connect a Flask webservice from a device which is not on the same network - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-11-01T17:35:08+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-connect-a-flask-webservice-from-a-device-which-is-not-on-the-same-network\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] Connect a Flask webservice from a device which is not on the same network"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/18780","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=18780"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/18780\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=18780"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=18780"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=18780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}