0

My structure Project

api
..app.py
....webapp
......init.py
......user
........init.py
........routes.py
......report
........init.py
........routes.py

app.py

import os
from webapp import create_app

env = os.environ.get('FLASK_ENV')

app = create_app('config.ProdConfig')

if __name__ == '__main__':
    app.run()

webapp\init.py

from flask import Flask
from flask_cors import CORS, cross_origin

def create_app(object_name):

  app = Flask(__name__)
  CORS(app)
  app.config.from_object(object_name)

  from webapp.user.routes import user
  from webapp.report.routes import report
  
  app.register_blueprint(user)
  app.register_blueprint(report)
  return app

webapp\user\routes.py

import os
from flask import Blueprint, jsonify, current_app
from logger import adm_logger
from .functions import userDataId, menuPrincipale

user = Blueprint('user', __name__, url_prefix='/user')

# check userdata
@user.route('userdata-id/<iddip>', methods=['GET'])
def userdata_id(iddip):
  data = userDataId(iddip)
  return jsonify(data)

file web.config iis

 <rewrite>
   <rules>
      <rule name="Handle History Mode 2 and custom 404/500" stopProcessing="true">
         <match url="(.*)" />
         <conditions logicalGrouping="MatchAll">
           <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
           <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
           <add input="{REQUEST_URI}" pattern="^/ticbu/(api)" negate="true" />
         </conditions>
       <action type="Rewrite" url="index.html" />
     </rule>
     <rule name="ApiProxyRule3" stopProcessing="true">
       <match url="/ticbu/api/(.*)" />
       <action type="Rewrite" url="ticbu/api/{R:1}" />
     </rule>
  </rules>
/rewrite>

when i call localhost/ticbu/api/user/userdata-id/11025 --- 404 Page Not Found what is the problem? i don't understand...in local development work fine

nickb84
  • 591
  • 2
  • 6
  • 11

1 Answers1

0

i found... only add /ticbu/api on the url_prefix='/ticbu/api/user' sorry!

nickb84
  • 591
  • 2
  • 6
  • 11
  • Has your problem been solved? If it is resolved, please mark the answer so that it can help others with similar problems. – Bruce Zhang Oct 27 '20 at 06:35