(05-01-2016, 12:06 AM)Bernkastel Wrote: Why do you advertise this thread in a RPG section
Because the fact that Discord throws highlights current channels is the same way they highlight unread channels, which is fucking autistic.
(04-30-2016, 10:27 PM)Yoko Wrote: how do I make an img hosting website ;/
idk how that would be coded ;/
Not sure if you're joking or not. Not that it's a stupid question, but the emojis make me uncertain.
- made it when I got really bored and wanted a place for me to throw shit up.
The base concept of an image host is fairly easy.
- Take files with image extensions
- Save them all to a directory with random names(if you so choose)
- Output uploaded image urls to users when finished
- Serve said images when url is requested
That's conveyed fairly simply in the following code using Python's Flask.
from flask import Flask, render_template, request, send_from_directory
#Configuring Flask to run properly with root privs, and setting static dir
#to serve static files(uploads)
app = Flask(__name__, static_url_path='/static')
ALLOWED_FILES = [
'jpg', 'png', 'gif',
'c', 'cpp', 'jpeg',
'txt', 'java', 'pdf'
@app.route('/', methods=['GET', 'POST'])
if request.method == 'POST':
f = request.files['file']
f_ext = f.filename.split('.')
if f_ext in ALLOWED_FILES:
f.save('static/uploads/' + f.filename)
return render_template('index.html', file_name=f.filename)
return render_template('index.html', rude_dood=True)
#So idiots can actually be served files.
return send_from_directory('static/uploads/', filename)
if __name__ == '__main__':
app.debug = True