I have a flask route app.add_url_rule("/<string:name>",'welcome',DataProcessor.welcome) what I want is to make the name parameter optional. How can I do it inside the add_url_rule method?
            Asked
            
        
        
            Active
            
        
            Viewed 7,355 times
        
    1
            
            
         
    
    
        swarnava112
        
- 421
- 8
- 19
1 Answers
0
            
            
        app.add_url_rule() does exactly the same as the @app.route() decorator. Therefore, this answer might help you out.
In short, it's not possible without setting default values to those parameters.
You can either use that approach, or use the request.args.
 
    
    
        Joost
        
- 3,609
- 2
- 12
- 29