Issue
I'm working on a project that integrates Django and VueJS. Last night, I made several changes to the frontend Vue components. Today, I decided to revert those changes via git. However, after doing so, I can no longer run my Django backend server; it simply freezes.
Symptoms:
- The Django
runservercommand does not complete; it freezes after the system checks. - No errors are displayed in the terminal or logs.
- The system became unresponsive to
Ctrl - Alt + Del during the first attempt to run the servers after the issue occurred, but it worked upon restarting the computer. I'm unsure if this is related.
(venv) PS C:\CTCTLab\backend\ctct_api> python manage.py runserver Watching for file changes with StatReloader Performing system checks...
System check identified no issues (0 silenced). The server does not progress to the point of displaying the usual "Starting development server at http://127.0.0.1:8000/" message.
Troubleshooting Steps Taken
I confirmed that the issue is not related to Django model inconsistencies. The problem persists even after making a minor change to a Django view:
@api_view(['GET'])
def question_stats_view(request):
question_ids = request.query_params.getlist('question_ids')
if not all(q_id.isdigit() for q_id in question_ids):
return Response({'error': 'Invalid question IDs'}, status=400)
response_data = [
QuestionStatsSerializer.get_question_stats(int(q_id))
for q_id in question_ids if q_id
]
return Response(response_data)
Updated code:
@api_view(['GET'])
def question_stats_view(request):
question_ids = request.query_params.get('question_ids')
# Split the ID string and remove empty spaces
question_ids = [qid.strip() for qid in question_ids.split(',') if qid.strip()]
print("question_stats_view log:", question_ids)
if not all(q_id.isdigit() for q_id in question_ids):
return Response({'error': 'Invalid question IDs'}, status=400)
response_data = [
QuestionStatsSerializer.get_question_stats(int(q_id))
for q_id in question_ids if q_id
]
return Response(response_data)
Resolution Attempts
I managed to get the backend running again by:
- Uninstalling XAMPP.
- Deleting the XAMPP directory.
- Reinstalling XAMPP.
- Recreating the database from a backup file.
After these steps, my Django project started working again. The issue seems to be with XAMPP (Apache + MariaDB) rather than the Django application itself, as the problems arise even with minimal changes to the Django codebase.
Questions
- Has anyone experienced similar issues with XAMPP that cause the Django development server to freeze?
- Could the freezing of the system when attempting to start the server indicate a deeper issue within XAMPP or the interaction with Django?
- Are there known conflicts between XAMPP services and Django's development server that could lead to such behavior?
Any insights or suggestions for preventing this in the future would be greatly appreciated. I'm concerned about this affecting my production deployment scheduled for this week.
Thank you for your assistance!