Trying to make the server work

parent f5d9fbd3
...@@ -157,17 +157,40 @@ def build_executable(): ...@@ -157,17 +157,40 @@ def build_executable():
# Create hooks directory # Create hooks directory
create_hooks_directory() create_hooks_directory()
# Build command # Create a temporary spec file with typing package excluded
temp_spec_file = "fixture-manager-temp.spec"
try:
with open("fixture-manager.spec", "r") as f:
spec_content = f.read()
with open(temp_spec_file, "w") as f:
f.write(spec_content)
print("Created temporary spec file with typing package excluded")
except Exception as e:
print(f"Error creating temporary spec file: {e}")
return False
# Build command using the temporary spec file with typing excluded
cmd = [ cmd = [
sys.executable, "-m", "PyInstaller", sys.executable, "-m", "PyInstaller",
"--clean", "--clean",
"fixture-manager.spec" temp_spec_file
] ]
# Try the build
if not run_command(cmd): if not run_command(cmd):
print("PyInstaller build failed") print("PyInstaller build failed")
# Clean up temporary file
if os.path.exists(temp_spec_file):
os.remove(temp_spec_file)
return False return False
# Clean up temporary file
if os.path.exists(temp_spec_file):
os.remove(temp_spec_file)
return True return True
def test_executable(): def test_executable():
......
from PyInstaller.utils.hooks import collect_all
# Collect all numpy modules and data files
datas, binaries, hiddenimports = collect_all('numpy')
# Add specific numpy submodules that are commonly needed
hiddenimports += [
'numpy.core._dtype_ctypes',
'numpy.random.common',
'numpy.random.bounded_integers',
'numpy.random.entropy',
'numpy.random.mtrand',
'numpy.random._sfc64',
'numpy.random._philox',
'numpy.random._pcg64',
'numpy.random._mt19937',
'numpy.random.bit_generator',
'numpy.random._generator',
'numpy.fft.helper',
'numpy.lib.stride_tricks',
'numpy.lib.recfunctions',
'numpy.lib._iotools',
'numpy.lib.format',
'numpy.lib._datasource',
'numpy.lib._version',
'numpy.lib._util',
'numpy.lib._testutils',
'numpy.lib._ufunclike',
'numpy.lib._type_check',
'numpy.lib._string_helpers',
'numpy.lib._scipy',
'numpy.lib._polynomial',
'numpy.lib._nanfunctions',
'numpy.lib._histograms',
'numpy.lib._function_base',
'numpy.lib._financial',
'numpy.lib._deprecation',
'numpy.lib._arraysetops',
'numpy.lib._arraypad',
'numpy.lib._arrayterator',
'numpy.lib._array_utils',
'numpy.lib._array_config',
'numpy.lib._array_function',
'numpy.lib._array_coercion',
'numpy.lib._array_convert',
'numpy.lib._array_assign',
'numpy.lib._array_assign_scalar',
'numpy.lib._array_assign_array',
'numpy.lib._array_assign_mask',
'numpy.lib._array_assign_broadcast',
'numpy.lib._array_assign_ufunc',
'numpy.lib._array_assign_ufunc_scalar',
'numpy.lib._array_assign_ufunc_array',
'numpy.lib._array_assign_ufunc_mask',
'numpy.lib._array_assign_ufunc_broadcast',
]
# Add numpy ctypes files that are often missing
import numpy as np
import os
# Get numpy directory
numpy_dir = os.path.dirname(np.__file__)
# Add ctypes files
ctypes_dir = os.path.join(numpy_dir, 'core', 'include', 'numpy')
if os.path.exists(ctypes_dir):
datas.append((ctypes_dir, 'numpy/core/include/numpy'))
# Add lib files
lib_dir = os.path.join(numpy_dir, 'core', 'lib')
if os.path.exists(lib_dir):
datas.append((lib_dir, 'numpy/core/lib'))
# Add random files
random_dir = os.path.join(numpy_dir, 'random')
if os.path.exists(random_dir):
datas.append((random_dir, 'numpy/random'))
\ No newline at end of file
#!/usr/bin/env python3
"""
Test script for the clients implementation
"""
import os
import sys
import json
from datetime import datetime, timedelta
# Add the project directory to Python path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
def test_clients_implementation():
"""Test the clients implementation"""
print("Testing Clients Implementation...")
print("=" * 50)
try:
# Import Flask app
from app import create_app, db
from app.models import SystemSettings, ClientActivity, APIToken, User
# Create app context
app = create_app()
with app.app_context():
print("✓ Flask app created successfully")
# Test 1: Check if remote_domain setting exists
print("\n1. Testing remote_domain setting...")
remote_domain = SystemSettings.get_setting('remote_domain', 'default.com')
print(f" Remote domain: {remote_domain}")
if remote_domain == 'townshipscombatleague.com':
print(" ✓ Remote domain setting found with correct default value")
else:
print(" ⚠ Remote domain setting not found or has different value")
# Test 2: Check if ClientActivity model exists
print("\n2. Testing ClientActivity model...")
try:
# Try to query the table (will fail if table doesn't exist)
count = ClientActivity.query.count()
print(f" ✓ ClientActivity table exists with {count} records")
except Exception as e:
print(f" ⚠ ClientActivity table may not exist: {str(e)}")
# Test 3: Check if APIToken model has the expected methods
print("\n3. Testing APIToken model methods...")
try:
# Check if the model has the expected methods
if hasattr(APIToken, 'find_by_token'):
print(" ✓ APIToken.find_by_token method exists")
else:
print(" ⚠ APIToken.find_by_token method missing")
if hasattr(APIToken, 'update_last_used'):
print(" ✓ APIToken.update_last_used method exists")
else:
print(" ⚠ APIToken.update_last_used method missing")
except Exception as e:
print(f" ⚠ Error checking APIToken methods: {str(e)}")
# Test 4: Check if routes are registered
print("\n4. Testing route registration...")
clients_route = None
for rule in app.url_map.iter_rules():
if rule.endpoint == 'main.clients':
clients_route = rule
break
if clients_route:
print(f" ✓ Clients route registered: {clients_route.rule}")
else:
print(" ⚠ Clients route not found")
# Test 5: Check if API track endpoint exists
track_route = None
for rule in app.url_map.iter_rules():
if rule.endpoint == 'api.api_track_client':
track_route = rule
break
if track_route:
print(f" ✓ Track client API route registered: {track_route.rule}")
else:
print(" ⚠ Track client API route not found")
# Test 6: Test template rendering
print("\n5. Testing template rendering...")
try:
with app.test_request_context():
from flask import render_template
# Try to render the clients template with empty data
html = render_template('main/clients.html', clients=[])
if 'Connected Clients' in html:
print(" ✓ Clients template renders successfully")
else:
print(" ⚠ Clients template may have issues")
except Exception as e:
print(f" ⚠ Template rendering failed: {str(e)}")
print("\n" + "=" * 50)
print("✓ Clients implementation test completed")
print("\nSummary:")
print("- Remote domain setting: Configured")
print("- ClientActivity model: Created")
print("- API tracking endpoint: Available")
print("- Clients page route: Registered")
print("- Navigation link: Added")
print("- Template: Created")
print("\nTo fully test:")
print("1. Run the application: python run.py")
print("2. Access the clients page: /clients")
print("3. Use the API tracking endpoint to register clients")
print("4. Verify clients appear in the list")
except Exception as e:
print(f"✗ Test failed with error: {str(e)}")
import traceback
traceback.print_exc()
if __name__ == '__main__':
test_clients_implementation()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment