Skip to content

Commit 038ff92

Browse files
committed
updating repo
1 parent 1681fdf commit 038ff92

153 files changed

Lines changed: 1284 additions & 31 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

FileFlow/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@ instance/
1515
# Ignore uploaded user files but keep the directory via .gitkeep
1616
user_files/*
1717
!user_files/.gitkeep
18+
19+
# Speedtest artifacts (local test executables and logs)
20+
speedtest
21+
speedtest*
22+
*.speedtest
23+
*.speedtest.log
24+
speedtest.log
25+
speedtest-results/

FileFlow/FIXES.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Import Errors - Fixed! ✓
2+
3+
## Issues Resolved
4+
5+
### 1. **ModuleNotFoundError: No module named 'backend'**
6+
**Problem**: When running Flask from the `backend` directory, Python couldn't find the `backend` module because it was inside the directory itself.
7+
8+
**Solution**: Added try/except blocks for all imports to handle both absolute paths (`backend.models.database`) when running from the FileFlow directory, and relative paths (`models.database`) when running from the backend directory.
9+
10+
### 2. **ImportError: cannot import name 'SearchProfile'**
11+
**Problem**: The `database.py` file was truncated/corrupted - the File class definition wasn't properly closed, and SearchProfile and ShareLink classes were missing.
12+
13+
**Solution**: Recreated the complete `backend/models/database.py` file with all four model classes:
14+
- `User` - User authentication model
15+
- `File` - File metadata model with enhanced fields
16+
- `SearchProfile` - Saved search configurations
17+
- `ShareLink` - File sharing links
18+
19+
### 3. **ImportError: cannot import name 'create_zip_archive'**
20+
**Problem**: app.py was trying to import a function `create_zip_archive` that didn't exist - the compression service uses a class-based approach with `CompressionService.create_zip()`.
21+
22+
**Solution**: Updated app.py to import `CompressionService` class and use `CompressionService.create_zip()` method instead.
23+
24+
### 4. **ImportError: attempted relative import beyond top-level package**
25+
**Problem**: API blueprint files used relative imports (`..models.database`) which don't work when the module is run as __main__ or from certain contexts.
26+
27+
**Solution**: Updated all API blueprint files to use try/except for imports, falling back to simple imports when relative imports fail.
28+
29+
## Files Modified
30+
31+
### Backend Files:
32+
-`backend/app.py` - Added try/except for all imports (models, config, blueprints, services)
33+
-`backend/models/database.py` - **Recreated** with complete model definitions
34+
-`backend/api/auth.py` - Added try/except for imports
35+
-`backend/api/files.py` - Added try/except for imports
36+
-`backend/api/folders.py` - Added try/except for imports
37+
-`backend/api/search.py` - Added try/except for imports
38+
-`backend/api/upload.py` - Added try/except for imports
39+
-`backend/api/compression.py` - Added try/except for imports
40+
41+
### Package Structure:
42+
- ✅ Created `backend/__init__.py`
43+
- ✅ Created `backend/api/__init__.py`
44+
- ✅ Created `backend/services/__init__.py`
45+
- ✅ Created `backend/models/__init__.py`
46+
- ✅ Created `backend/utils/__init__.py`
47+
48+
## How to Run
49+
50+
### Option 1: From FileFlow directory (Recommended)
51+
```bash
52+
cd /workspaces/file-uploader-viewing-mode-is-under-process-/FileFlow
53+
export FLASK_APP=backend.app
54+
export FLASK_ENV=development
55+
56+
# Initialize database (first time only)
57+
flask init-db
58+
59+
# Run Flask
60+
flask run --host=0.0.0.0 --port=5000
61+
```
62+
63+
### Option 2: Using the start script
64+
```bash
65+
cd /workspaces/file-uploader-viewing-mode-is-under-process-/FileFlow
66+
./start.sh
67+
```
68+
69+
This will start both:
70+
- Backend on http://localhost:5000
71+
- Frontend on http://localhost:3000
72+
73+
## Verification
74+
75+
All components now work correctly:
76+
- ✅ Flask app imports without errors
77+
- ✅ All API blueprints register successfully
78+
- ✅ Database models include all required classes
79+
- ✅ No more ModuleNotFoundError
80+
- ✅ No more ImportError
81+
- ✅ Database initializes successfully
82+
83+
## Technical Details
84+
85+
### Import Strategy
86+
The project now uses a flexible import strategy that works in multiple contexts:
87+
88+
```python
89+
try:
90+
from backend.models.database import db, User, File
91+
from backend.config import Config
92+
except ImportError:
93+
from models.database import db, User, File
94+
from config import Config
95+
```
96+
97+
This allows the code to work whether run from:
98+
- FileFlow directory: Uses `backend.*` imports
99+
- backend directory: Uses simple `models.*` imports
100+
- As a package: Uses `backend.*` imports
101+
102+
### Database Models
103+
Complete model structure:
104+
1. **User** - Authentication with bcrypt password hashing
105+
2. **File** - File metadata (filename, path, size, mimetype, hash, favorites, tags)
106+
3. **SearchProfile** - Saved search configurations
107+
4. **ShareLink** - Shareable file links with expiration and access tracking
108+
109+
All models are properly defined and can be imported successfully.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"files": {
3+
"main.css": "/static/css/main.9bbb668f.css",
4+
"main.js": "/static/js/main.6abf2264.js",
5+
"index.html": "/index.html",
6+
"main.9bbb668f.css.map": "/static/css/main.9bbb668f.css.map",
7+
"main.6abf2264.js.map": "/static/js/main.6abf2264.js.map"
8+
},
9+
"entrypoints": [
10+
"static/css/main.9bbb668f.css",
11+
"static/js/main.6abf2264.js"
12+
]
13+
}

FileFlow/frontend/build/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.6abf2264.js"></script><link href="/static/css/main.9bbb668f.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

FileFlow/frontend/build/static/css/main.9bbb668f.css

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FileFlow/frontend/build/static/css/main.9bbb668f.css.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FileFlow/frontend/build/static/js/main.6abf2264.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* @license React
3+
* react-dom.production.min.js
4+
*
5+
* Copyright (c) Facebook, Inc. and its affiliates.
6+
*
7+
* This source code is licensed under the MIT license found in the
8+
* LICENSE file in the root directory of this source tree.
9+
*/
10+
11+
/**
12+
* @license React
13+
* react-jsx-runtime.production.min.js
14+
*
15+
* Copyright (c) Facebook, Inc. and its affiliates.
16+
*
17+
* This source code is licensed under the MIT license found in the
18+
* LICENSE file in the root directory of this source tree.
19+
*/
20+
21+
/**
22+
* @license React
23+
* react.production.min.js
24+
*
25+
* Copyright (c) Facebook, Inc. and its affiliates.
26+
*
27+
* This source code is licensed under the MIT license found in the
28+
* LICENSE file in the root directory of this source tree.
29+
*/
30+
31+
/**
32+
* @license React
33+
* scheduler.production.min.js
34+
*
35+
* Copyright (c) Facebook, Inc. and its affiliates.
36+
*
37+
* This source code is licensed under the MIT license found in the
38+
* LICENSE file in the root directory of this source tree.
39+
*/

FileFlow/frontend/build/static/js/main.6abf2264.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)