Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

124
Vistas
My Flask server on Pythonanywhere.com not works at my Ionic app

I have a problem, when giv my Falsk py to cloud serve phytonanywhere.com works at Hi, I have a problem, when I giv my Falsk py to cloud serve phytonanywhere.com works at Chrome, but not works at app.

This is my flask_app.py

from flask import Flask, jsonify,request
from posts import posts


app=Flask(__name__)

@app.route('/')
def index():
    lang = request.headers.get("Accept-Language", 'sk')[:2]

    p = list(map (lambda post: translate(post, lang), posts))

    return jsonify(p)


def translate(post, lang):
    translation = next (t for t in post['translations'] if t['locale'] == lang)

    return {
        "id": post ['id'],
        "title": translation ['title'],
        "description": translation ['description'],
        "image": post['image'],
}

Works at Chrome, I see this.

enter image description here

And my app code is

import { Component, OnInit } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';


@Component({
  selector: 'app-posts2',
  templateUrl: './posts.component.html',
  styleUrls: ['./posts.component.scss'],
})
export class PostsComponent implements OnInit {
  
  posts:any = [];
  constructor(private http: HttpClient) { }

 

  ngOnInit() {
    

    const lang = localStorage.getItem('lang') || 'sk';
    
    const headers = new HttpHeaders({
      'Accept-Language': lang
    })   
  
  
    this.http.get('http://miki83.pythonanywhere.com/', {
      headers: headers
    }).subscribe(data=>{
      console.log();
      this.posts = data;
       });
  }

}

How is problem? I paste the cloud Url to app.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda