Skip to content

Conversation

@foundkey
Copy link

Describe the Pull Request

When I was developing with PyCharm, I found that the runserver mode was disabled, which made it impossible to add breakpoints for debugging.

I modified manage.py and tried to allow the project to be started using runserver, and found that the application lost its style in this mode.

The same problem was asked in A #901 .

This is because STATICFILES_DIRS is not configured correctly, resulting in failure to obtain static files in runserver mode.

During the adjustment process, I found some other problems and fixed them as well:

  • MIDDLEWARE_CLASSES has been deprecated in django 1.10, Middleware in this configuration no longer works and needs to be moved to a new configuration item.
  • SessionAuthenticationMiddleware depredated from django v2.0.
  • WhiteNoise in Django probject, it is recommended to use middleware for configuration, And cooperate with manage.py collectstatic command to process static files to improve the access performance of static files.

After modifying the configuration of WhiteNoise, if you use run.sh to start the application, it will be slower because of processing static files. But I think it is worth it.

Checklist for PR

  • Run MobSF unit tests and lint tox -e lint,test
  • Tested Working on Linux, Mac, Windows, and Docker
  • Add unit test for any new Web API (Refer: StaticAnalyzer/tests.py)
  • Make sure tests are passing on your PR MobSF tests

Additional Comments (if any)

DESCRIBE HERE

@ajinabraham
Copy link
Member

Thanks for the PR. I will review this and get back.

@foundkey
Copy link
Author

It doesn't pass CI tests, I will fix it.

@foundkey
Copy link
Author

Before running unit tests, the test CI did not execute manage.py collectstatic, resulting in a failure in accessing static files.

And after adding authentication, static_analysis_test did not simulate login, causing subsequent tests to fail API access due to authentication issues.

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.

2 participants