loading int data from the page

Hi, I want to get dashboard data for editing, but it keeps occur an error and error log logs nothing regarding this page.

con = mysql.connect("hostaddress", "username", "pw", "database")
@app.route('/showSchoolPost/<int:School_Id>', methods=['GET'])
def showschoolpost(School_Id):
    if session.get('user'):
        #con = mysql.connect()
        cursor = con.cursor()
        cursor.execute("select * from school where School_Id = %s",(School_Id))
        schoolpost = cursor.fetchall()
        return render_template('school_page_showpost.html', schoolpost=schoolpost)

        return redirect('/error')
except Exception as e:
    return redirect('/error')

I checked it returns School_Id like /showSchoolPost/1, but it seems not to get as a parameter. I tried print(School_Id) and it printed nothing. This code worked in localhost. I can't find the error. Please help. Thanks.

And also, ckeditor doesn't work on the server. How can I fix it?

Firstly, I'd definitely recommend using a MySQL connection manager/ORM like SQLAlchemy for any live website -- direct MySQL connections can cause problems when you have multiple worker processes running, and when your site is up for more time than the MySQL server's connection timeout. Check out our Flask tutorial for hints and tips on how to set that up.

Regarding your specific problems: for the first one, just to make sure I understand what's happening -- you're saying that when you go to, you don't get the integer 1 in your parameter School_Id -- is that right? If so, do you have any other views handling URLs starting with /showSchoolPost/?

Regarding the ckeditor problem -- have you set up your static file routing so that the JavaScript assets that it depends on are being served up? If not, you'll see 404 errors in your browser's developer console when you visit a site that uses it.

First, it is a dashboard so if I click one of the list, it is supposed to open clicked post. That's why I need to get school_id. It worked on localhost but somehow it doesn't work on the server. Because print(school_id) printed nothing, I guess it doesn't store school_id. This is the only URL starting with /showSchoolPost but I do use School_Id several times. For better understading, this is the html that redirect to.

{% for row in schoolpost %}
        <div class="ui blue fluid card">
                 <div class="content">

                    <div id="titleOutput" class="two fields">
                        <div class="field">
                        <textarea id="ckeditor1" class="cleditor" disabled="yes" readonly="yes" rows="1">{{row[1]}}</textarea></div></div>

                    <div id="contentsOutput" class="field">

                      <textarea id="ckeditor2" class="cleditor" disabled="yes" readonly="yes" rows="10" cols="80">{{row[2]}}


    var editor2=CKEDITOR.replace( 'ckeditor2' );



                <div class="extra content">
                    <div class="right floated author">
                        <span class="right floated time">{{row[4]}}&nbsp;</span>
                            <span class="category">School board&nbsp;</span>
                        <span class="writer">


Second, I uploaded all the elements in ckeditor folder. And editor just doesn't show up on textarea. textarea is not loaded. By the way, why don't you allow us upload whole folder at once? it's inconvenience:(

For the first problem, what does it say at in the browser's URL bar when you click on the link that takes you to the URL that should display the page? Is the school ID present in the URL? Could you give me a link to a URL that shows the problem?

For the second problem, uploading the contents of the folder isn't enough -- the files you've uploaded to PythonAnywhere aren't accessible from the public Internet by default, as that would be a security issue. You need to set up static file mapping on the "Web" tab to say, "when a request comes in for this URL, send back this file". Here's a link to the static files help page.

The easiest way to upload a folder is to zip it up into one file on your local machine, then upload the zip file, and then use the unzip command from a bash console. Or, even better, you can put your code into a Git repository, then push it to somewhere like GitHub or Bitbucket, then pull the code down from there -- that would also allow you to make changes on PythonAnywhere or locally, and let Git merge them all together.

The website is You can login with admin/admin. On this page, if you click a post, it should return like but it just returns error page. I realized it goes to /showSchoolPost/1 link by looking access log. Even though I looked up error log and access log, I couldn't find the reason.

What does your error page say? It it's just a generic error, you could try putting your app into debug mode, which usually gives more detailed error messages.

How can I put into debug mode? Even if I put app.debug=True, bash doesn't show anything. I am so lost ;(

what about the error log on your web tab?