| |
|
| | import os
|
| |
|
| | def create_directory_structure():
|
| |
|
| | structure = {
|
| | 'app': {
|
| | 'static': {
|
| | 'css': {},
|
| | 'js': {},
|
| | 'img': {},
|
| | 'uploads': {}
|
| | },
|
| | 'templates': {
|
| | 'admin': {},
|
| | 'components': {}
|
| | },
|
| | 'database': {},
|
| | }
|
| | }
|
| |
|
| |
|
| | files = [
|
| | 'app/__init__.py',
|
| | 'app/routes.py',
|
| | 'app/models.py',
|
| | 'app/utils.py',
|
| | 'app/ai_service.py',
|
| | 'app/templates/base.html',
|
| | 'app/templates/index.html',
|
| | 'app/templates/article.html',
|
| | 'app/templates/editor.html',
|
| | 'app/templates/admin/login.html',
|
| | 'app/templates/admin/dashboard.html',
|
| | 'app/templates/components/header.html',
|
| | 'app/templates/components/footer.html',
|
| | 'app/static/css/style.css',
|
| | 'app/static/js/editor.js',
|
| | 'app/static/js/main.js',
|
| | '.env.example',
|
| | 'config.py',
|
| | 'run.py',
|
| | 'requirements.txt'
|
| | ]
|
| |
|
| | def create_directories(base_path, structure):
|
| | for key, value in structure.items():
|
| | path = os.path.join(base_path, key)
|
| | os.makedirs(path, exist_ok=True)
|
| | if isinstance(value, dict):
|
| | create_directories(path, value)
|
| |
|
| |
|
| | create_directories('.', structure)
|
| |
|
| |
|
| | for file_path in files:
|
| | open(file_path, 'a').close()
|
| |
|
| |
|
| | env_content = """FLASK_ENV=development
|
| | FLASK_SECRET_KEY=your-secret-key
|
| | ADMIN_USERNAME=admin
|
| | ADMIN_PASSWORD=password
|
| | AI_API_KEY=your-api-key
|
| | AI_BASE_URL=https://api.deepseek.com"""
|
| |
|
| | with open('.env.example', 'w') as f:
|
| | f.write(env_content)
|
| |
|
| | print("Project structure created successfully!")
|
| |
|
| | if __name__ == "__main__":
|
| | create_directory_structure() |