fix files adding
This commit is contained in:
parent
2771995a0e
commit
3bf3988354
1
SmearcarDB/.gitignore
vendored
1
SmearcarDB/.gitignore
vendored
@ -114,3 +114,4 @@ venv.bak/
|
|||||||
*.p
|
*.p
|
||||||
*.txt
|
*.txt
|
||||||
*.db
|
*.db
|
||||||
|
files/
|
||||||
|
|||||||
@ -11,7 +11,7 @@ app.config.update(
|
|||||||
TEMPLATES_AUTO_RELOAD=True
|
TEMPLATES_AUTO_RELOAD=True
|
||||||
)
|
)
|
||||||
db = SQLAlchemy(app)
|
db = SQLAlchemy(app)
|
||||||
|
working_dir = os.path.dirname(__file__)
|
||||||
|
|
||||||
class Frequency(db.Model):
|
class Frequency(db.Model):
|
||||||
language_id = db.Column(db.Integer, db.ForeignKey('language.id'), primary_key=True)
|
language_id = db.Column(db.Integer, db.ForeignKey('language.id'), primary_key=True)
|
||||||
@ -166,7 +166,10 @@ def source_add():
|
|||||||
"password": request.form["password"]
|
"password": request.form["password"]
|
||||||
}, 2):
|
}, 2):
|
||||||
f = request.files['file']
|
f = request.files['file']
|
||||||
f.save("files/"+request.form['lang_id'])
|
write_path = os.path.join(working_dir, "files", request.form['lang_id'])
|
||||||
|
# with open(write_path, 'w') as a:
|
||||||
|
# a.write()
|
||||||
|
f.save(write_path)
|
||||||
return "nice"
|
return "nice"
|
||||||
|
|
||||||
return "Error"
|
return "Error"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user