Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autorun collectstatic when django container starts #1522

Merged
merged 1 commit into from
Jul 26, 2024
Merged

Conversation

ihsaan-ullah
Copy link
Collaborator

@ihsaan-ullah ihsaan-ullah commented Jul 11, 2024

@ mention of reviewers

@Didayolo

A brief description of the purpose of the changes contained in this PR.

django container command updated to run collectstatic when it starts. Added caddy_data and caddy_config to gitignore

Issues this PR resolves

A checklist for hand testing

  • delete src/staticfiles folder
  • run docker-compose up -d
  • check that src/staticfiles folder is created
  • check that CSS works when you access it from localhost

Checklist

  • Code review by me
  • Hand tested by me
  • I'm proud of my work
  • Code review by reviewer
  • Hand tested by reviewer
  • CircleCi tests are passing
  • Ready to merge

@ihsaan-ullah ihsaan-ullah linked an issue Jul 11, 2024 that may be closed by this pull request
@Didayolo
Copy link
Member

@ihsaan-ullah

It seems that running the collect static command stills copy files after starting the service:

% docker compose up -d                                          
WARN[0000] The "RABBITMQ_HTTP_PROXY" variable is not set. Defaulting to a blank string. 
WARN[0000] The "RABBITMQ_HTTPS_PROXY" variable is not set. Defaulting to a blank string. 
WARN[0000] The "RABBITMQ_NO_PROXY" variable is not set. Defaulting to a blank string. 
[+] Running 12/12Network codabench_default             Created                                                                                                                                                       0.0sContainer codabench-rabbit-1          Started                                                                                                                                                       3.1sContainer codabench-redis-1           Started                                                                                                                                                       0.7sContainer codabench-minio-1           Healthy                                                                                                                                                       8.6sContainer codabench-builder-1         Started                                                                                                                                                       3.2sContainer codabench-db-1              Started                                                                                                                                                       3.1sContainer codabench-flower-1          Started                                                                                                                                                       4.1sContainer codabench-createbuckets-1   Started                                                                                                                                                       9.3sContainer codabench-django-1          Started                                                                                                                                                       4.1sContainer codabench-site_worker-1     Started                                                                                                                                                       3.6sContainer codabench-compute_worker-1  Started                                                                                                                                                       5.1sContainer codabench-caddy-1           Started                                                                                                                                                       5.2s

% docker compose exec django ./manage.py collectstatic --noinput
WARN[0000] The "RABBITMQ_HTTP_PROXY" variable is not set. Defaulting to a blank string. 
WARN[0000] The "RABBITMQ_HTTPS_PROXY" variable is not set. Defaulting to a blank string. 
WARN[0000] The "RABBITMQ_NO_PROXY" variable is not set. Defaulting to a blank string. 

2 static files copied to '/app/src/staticfiles', 303 unmodified.

Maybe it is a question of timing.

@ihsaan-ullah
Copy link
Collaborator Author

2 static files copied to '/app/src/staticfiles', 303 unmodified.

If you remove the command from docker-compose.yaml. Do you still see 2 static files copied or 305 files copied when you run it manually?

Before checking this make sure to delete staticfiles folder

@ihsaan-ullah
Copy link
Collaborator Author

@Didayolo I have checked this and the number of collected files is the same before and after running collectstatic. It still shows 2 files modified but no new file is added.

Do we want to check which files are changed?

@Didayolo Didayolo merged commit 6c81635 into develop Jul 26, 2024
1 check passed
@Didayolo Didayolo deleted the collect_static branch July 26, 2024 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatically run collect static on start up
2 participants