Basic QWEN2.5-Coder initial build.
This commit is contained in:
commit
6352aff937
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.13 (Collector)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/Collector.iml" filepath="$PROJECT_DIR$/.idea/Collector.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="d00df981-e46f-4f2a-b692-bc9c2d1c02cf" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/.idea/Collector.iml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/profiles_settings.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/config/config.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/models/album.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/templates/admin.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/templates/index.html" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Python Script" />
|
||||
<option value="HTML File" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo"><![CDATA[{
|
||||
"associatedIndex": 8
|
||||
}]]></component>
|
||||
<component name="ProjectId" id="2xpZJUYSkt5VemoOjvaE9ilwZkM" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"DefaultHtmlFileTemplate": "HTML File",
|
||||
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"git-widget-placeholder": "main",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="SharedIndexes">
|
||||
<attachedChunks>
|
||||
<set>
|
||||
<option value="bundled-js-predefined-d6986cc7102b-6a121458b545-JavaScript-PY-251.25410.159" />
|
||||
<option value="bundled-python-sdk-e0ed3721d81e-36ea0e71a18c-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-251.25410.159" />
|
||||
</set>
|
||||
</attachedChunks>
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="d00df981-e46f-4f2a-b692-bc9c2d1c02cf" name="Changes" comment="" />
|
||||
<created>1748636903987</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1748636903987</updated>
|
||||
<workItem from="1748636905021" duration="2154000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
# app.py
|
||||
|
||||
from flask import Flask, request, render_template, redirect, url_for
|
||||
from sqlalchemy import create_engine, func
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from models.album import Base, Album
|
||||
|
||||
app = Flask(__name__)
|
||||
engine = create_engine(config['DB_URL'])
|
||||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
Base.metadata.create_all(bind=engine)
|
||||
|
||||
|
||||
def get_db():
|
||||
db = SessionLocal()
|
||||
try:
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
db = next(get_db())
|
||||
albums = db.query(Album).all()
|
||||
return render_template('index.html', albums=albums)
|
||||
|
||||
|
||||
@app.route('/admin', methods=['GET', 'POST'])
|
||||
def admin():
|
||||
if request.method == 'POST':
|
||||
action = request.form['action']
|
||||
album_id = int(request.form['album_id'])
|
||||
|
||||
db = next(get_db())
|
||||
|
||||
if action == 'edit':
|
||||
title = request.form['title']
|
||||
artist = request.form['artist']
|
||||
year = int(request.form['year'])
|
||||
|
||||
album = db.query(Album).filter(Album.id == album_id).first()
|
||||
if album:
|
||||
album.title = title
|
||||
album.artist = artist
|
||||
album.year = year
|
||||
db.commit()
|
||||
elif action == 'delete':
|
||||
album = db.query(Album).filter(Album.id == album_id).first()
|
||||
if album:
|
||||
db.delete(album)
|
||||
db.commit()
|
||||
|
||||
return redirect(url_for('admin'))
|
||||
|
||||
db = next(get_db())
|
||||
albums = db.query(Album).all()
|
||||
return render_template('admin.html', albums=albums)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# config/config.py
|
||||
|
||||
from typing import Dict
|
||||
|
||||
config: Dict[str, str] = {
|
||||
"DB_URL": "mysql+pymysql://username:password@hostname/database",
|
||||
"ADMIN_PASSWORD": "admin_password"
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# models/album.py
|
||||
|
||||
from sqlalchemy import Column, Integer, String
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
|
||||
class Album(Base):
|
||||
__tablename__ = 'albums'
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
title = Column(String(255), nullable=False)
|
||||
artist = Column(String(255), nullable=False)
|
||||
year = Column(Integer, nullable=False)
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
<!-- templates/admin.html -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Admin Panel</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 20px;
|
||||
}
|
||||
h1 {
|
||||
color: #333;
|
||||
}
|
||||
form {
|
||||
max-width: 400px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
input[type="text"], input[type="number"] {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
button {
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
button:hover {
|
||||
background-color: #45a049;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Add Album</h1>
|
||||
<form method="POST">
|
||||
<label for="title">Title:</label>
|
||||
<input type="text" id="title" name="title" required><br><br>
|
||||
|
||||
<label for="artist">Artist:</label>
|
||||
<input type="text" id="artist" name="artist" required><br><br>
|
||||
|
||||
<label for="year">Year:</label>
|
||||
<input type="number" id="year" name="year" required><br><br>
|
||||
|
||||
<button type="submit">Add Album</button>
|
||||
</form>
|
||||
|
||||
<h1>Manage Albums</h1>
|
||||
<ul>
|
||||
{% for album in albums %}
|
||||
<li>
|
||||
{{ album.title }} by {{ album.artist }} ({{ album.year }})
|
||||
<form method="POST" style="display: inline;">
|
||||
<input type="hidden" name="action" value="edit">
|
||||
<input type="hidden" name="album_id" value="{{ album.id }}">
|
||||
<button type="submit">Edit</button>
|
||||
</form>
|
||||
<form method="POST" style="display: inline;">
|
||||
<input type="hidden" name="action" value="delete">
|
||||
<input type="hidden" name="album_id" value="{{ album.id }}">
|
||||
<button type="submit">Delete</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!-- templates/index.html -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Music Album Catalog</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 20px;
|
||||
}
|
||||
h1 {
|
||||
color: #333;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
li {
|
||||
background-color: #f9f9f9;
|
||||
border: 1px solid #ddd;
|
||||
margin-bottom: 10px;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Albums</h1>
|
||||
<ul>
|
||||
{% for album in albums %}
|
||||
<li>{{ album.title }} by {{ album.artist }} ({{ album.year }})</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue