title: Redirecting to PHP file in Flask
body: <p>I am running a localhost website using Flask and python. I have some php files that I want to run when the users click a button. Problem is that Flask isn't recognizing the PHP file as PHP code and the code is showing up as text on the webpage. It's showing the text of all the echo statements, but the words in those statements correspond to variable in the code that allow the user to login and logout of the website. What do I do?</p>
  
  <p>Python Code:</p>
  
  <pre><code>@app.route('/example.php')
  def phpexample():
      return render_template('example.php')
  </code></pre>
  
  <p>This shows a html page with text resulting from the <code>echo</code> statements.</p>
  
  <p>The PHP code (example.php):</p>
  
  <pre><code>&lt;?php
      require ('steamauth/steamauth.php');  
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Eliminate Phishers! Join Steap now&lt;/title&gt;
      &lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;
          &lt;meta name="description" content="" /&gt;
          &lt;meta name="keywords" content="" /&gt;
          &lt;!--[if lte IE 8]&gt;&lt;script src="css/ie/html5shiv.js"&gt;&lt;/script&gt;&lt;![endif]--&gt;
          &lt;script src="js/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script src="js/skel.min.js"&gt;&lt;/script&gt;
          &lt;script src="js/init.js"&gt;&lt;/script&gt;
          &lt;noscript&gt;
              &lt;link rel="stylesheet" href="css/skel.css" /&gt;
              &lt;link rel="stylesheet" href="css/style.css" /&gt;
              &lt;link rel="stylesheet" href="css/style-wide.css" /&gt;
          &lt;/noscript&gt;
          &lt;!--[if lte IE 8]&gt;&lt;link rel="stylesheet" href="css/ie/v8.css" /&gt;&lt;![endif]--&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
          &lt;!-- Header --&gt;
              &lt;div id="header"&gt;
                  &lt;span class="logo icon fa-paper-plane-o"&gt;&lt;/span&gt;
                  &lt;h1&gt;Welcome. This is Steap&lt;/h1&gt;
                  &lt;p&gt;A website designed to help eliminate phishers 
                  &lt;br /&gt;
                  and hackers on Steam.&lt;/p&gt;
              &lt;/div&gt;
  
          &lt;!-- Main --&gt;
              &lt;div id="main"&gt;
  
                  &lt;header class="major container small"&gt;
                      &lt;h3&gt;
                      &lt;?php
  
  if(!isset($_SESSION['steamid'])) {
  
      echo "welcome guest! &lt;br /&gt;\n please login ";
      steamlogin(); //login button
  
  }  else {
      include ('steamauth/userInfo.php');
      $url = $steamprofile['profileurl'];
      if ($steamprofile['personastate'] == 0) {
          $state = '&lt;span style="color:#616161";&gt;(Offline)&lt;/span&gt;';
          $picture = '&lt;span style="color:#616161";&gt;&lt;img src="'.$steamprofile['avatarfull'].'" title = "" alt = ""&gt;&lt;/span&gt;';
  
      } else if ($steamprofile['personastate'] == 1) {
          $state = '&lt;span style="color:#006EFF";&gt;(Online)&lt;/span&gt;';
          $picture = '&lt;span style="border: 10px dotted #006EFF;"&gt;&lt;img src="'.$steamprofile['avatarfull'].'" title = "" alt = ""&gt;&lt;/span&gt;';
      } else if ($steamprofile['personastate'] == 2) {
          $state = '&lt;span style="color:#006EFF";&gt;(Busy)&lt;/span&gt;';
          $picture = '&lt;span style="border-color:#006EFF border-style: solid";&gt;&lt;img src="'.$steamprofile['avatarfull'].'" title = "" alt = ""&gt;&lt;/span&gt;';
      } else if ($steamprofile['personastate'] == 3) {
          $state = '&lt;span style="color:#006EFF";&gt;(Away)&lt;/span&gt;';
          $picture = '&lt;span style="border-color:#006EFF border-style: solid";&gt;&lt;img src="'.$steamprofile['avatarfull'].'" title = "" alt = ""&gt;&lt;/span&gt;';
      } else if ($steamprofile['personastate'] == 4) {
          $state = '&lt;span style="color:#006EFF";&gt;(Snooze)&lt;/span&gt;';
          $picture = '&lt;span style="border-color:#006EFF border-style: solid";&gt;&lt;img src="'.$steamprofile['avatarfull'].'" title = "" alt = ""&gt;&lt;/span&gt;';
      } else if ($steamprofile['personastate'] == 5) {
          $state = '&lt;span style="color:#006EFF";&gt;(Looking to Trade)&lt;/span&gt;';
          $picture = '&lt;span style="border-color:#006EFF border-style: solid";&gt;&lt;img src="'.$steamprofile['avatarfull'].'" title = "" alt = ""&gt;&lt;/span&gt;';
      } else if ($steamprofile['personastate'] == 6) {
          $state = '&lt;span style="color:#006EFF";&gt;(Looking to Play)&lt;/span&gt;';
          $picture = '&lt;span style="border-color:#006EFF border-style: solid";&gt;&lt;img src="'.$steamprofile['avatarfull'].'" title = "" alt = ""&gt;&lt;/span&gt;';
      }
  
  
      //Protected content
      echo "Welcome back" . "&lt;/br&gt; &lt;/br&gt;" . $picture ."&lt;/br&gt;". $steamprofile['personaname'] . "&lt;/br&gt;" .$state .  "&lt;/br&gt;".  "Steam ID: ". $steamprofile['steamid'] . "&lt;/br&gt;";
      echo '&lt;a href="' . $url . '"&gt;Steam Profile&lt;/a&gt;'  . "&lt;/br&gt; &lt;/br&gt;" . "&lt;form action=\"steamauth/logout.php\" method=\"post\"&gt;&lt;input value=\"Logout\" type=\"submit\" /&gt;&lt;/form&gt;"; // Display their avatar!
  
  }    
  ?&gt;
  &lt;/h3&gt;
                  &lt;/header&gt;
  
                  &lt;footer class="major container small"&gt;
  
                      &lt;ul class="actions"&gt;
                          &lt;li&gt;&lt;a href="index.html" class="button"&gt;Get Phishers&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/footer&gt;
  
              &lt;/div&gt;
  
          &lt;!-- Footer --&gt;
              &lt;div id="footer"&gt;
                  &lt;div class="container small"&gt;
  
                      &lt;header class="major last"&gt;
                          &lt;h2&gt;Questions or comments?&lt;/h2&gt;
                      &lt;/header&gt;
  
                      &lt;p&gt;Program not working? Not detecting the phishers properly? &lt;br \&gt; Send us a message. We'll be sure to back to you as soon as possible.&lt;/p&gt;
  
                      &lt;form method="post" action="#"&gt;
                          &lt;div class="row collapse-at-2"&gt;
                              &lt;div class="6u"&gt;
                                  &lt;input type="text" name="name" placeholder="Name" /&gt;
                              &lt;/div&gt;
                              &lt;div class="6u"&gt;
                                  &lt;input type="email" name="email" placeholder="Email" /&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class="row"&gt;
                              &lt;div class="12u"&gt;
                                  &lt;textarea name="message" placeholder="Message" rows="6"&gt;&lt;/textarea&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class="row"&gt;
                              &lt;div class="12u"&gt;
                                  &lt;ul class="actions"&gt;
                                      &lt;li&gt;&lt;input type="submit" value="Send Message" /&gt;&lt;/li&gt;
                                  &lt;/ul&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/form&gt;
  
                      &lt;ul class="icons"&gt;
                          &lt;li&gt;&lt;a href="#" class="icon fa-twitter"&gt;&lt;span class="label"&gt;Twitter&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="#" class="icon fa-facebook"&gt;&lt;span class="label"&gt;Facebook&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="#" class="icon fa-instagram"&gt;&lt;span class="label"&gt;Instagram&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="#" class="icon fa-github"&gt;&lt;span class="label"&gt;Github&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="#" class="icon fa-dribbble"&gt;&lt;span class="label"&gt;Dribbble&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
  
                      &lt;ul class="copyright"&gt;
                          &lt;li&gt;&amp;copy; Steap 2014 All rights reserved.&lt;/li&gt;&lt;li&gt;Design: &lt;a href="http://html5up.net"&gt;HTML5 UP&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
  
                  &lt;/div&gt;
              &lt;/div&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>