Allow users to post content on website


#1

I am having a hard time figuring out how to code an add page feature to allow users to add pages to a website. The pages have a template and I want to allow them to type in information in the template and when they submit, a unique page is added to the website. If anyone can shine a light on how I could achieve this that would be great. Thank you!


#2

Any back-end language (nodeJS, Java, c#, ruby (on rails), python, go and many more) can do this.

Essential you submit the form to your server, the back-end language handles saving to the database and sending a response.

What back-end language and database do you use?


#3

I use Python for my back-end language and mySQL for my database.


#4

Look into how you can parse and string encode all user input so nobody can pass in executable code. Never allow unecoded content to reach your database. That means stripping HTML and anything else that looks like code immediately after the user submits it.

This can be done client-side but can be circumvented so server-side safeguards need to be in place. Read up on this for more details.


#5

I’m looking into how to make a list of all these added pages from the users and allowing the upload of these pages. I understand what coding languages I need, but I need to read or watch a tutorial because I do not know how to do it. Can someone please direct me to a source? Thank you


#6

You need several components (forms, users, templates, database)
Presumably you aren’t using just python, but something like flask or django - so you’d look up django’s documentation for those things (they come bundled with django) or find extensions for flask which do those things (for example: flask-wtf, flask-login, jinja2, flask-sqlalchemy)
Pretty much every webserver tutorial includes how to do those things, so a bit of googling for whatever you’re already using so far should get you a couple of choices of tutorials


#7

A list? Use a database. @ionatan is right in this regard, doing this purely in python without any libraries or frameworks is a lot of work


#8

Alright thanks guys! I will look into some tutorials and use libraries.