On 16/07/2020 3:11 pm, Kshitij Kotasthane wrote:
> If you could provide give a copy of the run-local.sh, that'd be great.
I don't have time to convert it into a bash script ... but you should be
able to pick a minimum section of it and get your own bash script going.
I started small and kept adding to it. Double-colon in a batch file is a
comment and a single colon starts a label. Set sets an environment
variable for the duration of the session. Here it is ...
Good luck
Mike
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
@echo off echo . echo . echo . echo Should be running in virtualenv echo
. echo . echo . echo . SET HOUR=%time:~0,2% SET
dtStamp9=0%time:~1,1%:%time:~3,2%:%time:~6,2% SET
dtStamp24=%time:~0,2%:%time:~3,2%:%time:~6,2% if "%HOUR:~0,1%" == " "
(SET dtStamp=%dtStamp9%) else (SET dtStamp=%dtStamp24%) set proj=train
set app1=common set port= :: run-local set test=mike-test set
dev=mike-local set production=local set port=8999 :: run-staging ::set
test=staging ::set dev=staging ::set production=staging :: run-prd ::set
test=production ::set dev=production ::set production=production set
testdata=%app1%\fixtures\test_data.json set
initdata=%app1%\fixtures\initial_data.json if %2xx==xx ( set apps=%app1%
billing course credit ) else ( set apps=%2 ) :: run if %1xx==xx ( set
settings=%proj%.settings.%dev% echo on echo ... %settings% ... echo off
python manage.py runserver %port% --settings=%proj%.settings.%dev% goto
end ) else ( goto %1 ) :: End of args beginning of commands :check set
tempcheck=production echo . echo checking security settings with
%proj%.settings.%tempcheck% echo = = = = = = = See security.txt = = = =
= = = = echo . python manage.py check --deploy
--settings=%proj%.settings.%tempcheck% goto end :: - - - - - - - - - - -
- - - end check :collectstatic python manage.py collectstatic
--settings=%proj%.settings.%production% --verbosity=2 goto end :: - - -
- - - - - - - - - - - end collectstatic :coverage coverage run manage.py
test --settings=%proj%.settings.%test% --verbosity=1 %apps% echo %apps%
coverage html --omit="*/Lib/*","*/tests/*","*/migrations/*","manage.py"
goto end :: - - - - - - - - - - - - - - end coverage :dumpdata echo .
echo dumping data (less --excludes) to %testdata% echo . python
manage.py dumpdata --settings=%proj%.settings.%production% --indent=2
--verbosity=0 --natural-primary --natural-foreign --all
--exclude=contenttypes --exclude=auth.permission
--exclude=admin.logentry --exclude=sessions.session
--exclude=billing.client --exclude=billing.relationship
--exclude=billing.share --exclude=billing.price --exclude=billing.token
--exclude=billing.receipt --exclude=billing.split --exclude=common.user
--exclude=common.user_courses --exclude=common.user_course_note
--exclude=common.userprofile --exclude=course.answer
--exclude=course.course --exclude=course.instruction
--exclude=course.question --exclude=credit.credit > %testdata% copy
%testdata% %initdata% /Y goto end :: - - - - - - - - - - - - - - end
dumpdata :fake echo . echo faking migration with %proj%.settings.%dev%
echo . python manage.py migrate --fake --settings=%proj%.settings.%dev%
%apps% %3 goto end :: - - - - - - - - - - - - - - end fake
:makeemptymigrations :makempty python manage.py makemigrations --empty
--settings=%proj%.settings.%dev% %apps% goto end :: - - - - - - - - - -
- - - - end makeempty :makemigrations python manage.py makemigrations
--settings=%proj%.settings.%dev% %apps% goto end :: - - - - - - - - - -
- - - - end makemigrations :migrate echo . echo migrating with
%proj%.settings.%dev% if not %3xx==xx echo migration name is %3 echo .
echo . if %2xx==xx ( python manage.py migrate
--settings=%proj%.settings.%dev% ) else ( python manage.py migrate
--settings=%proj%.settings.%dev% %apps% %3 ) goto remove :: - - - - - -
- - - - - - - - end migrate :remove_stale_contenttypes :remove python
manage.py remove_stale_contenttypes
--settings=%proj%.settings.%production% --verbosity=2 goto end :: - - -
- - - - - - - - - - - end remove_stale_contenttypes :shell python
manage.py shell --settings=%proj%.settings.%dev% goto end :: - - - - - -
- - - - - - - - end shell :squashmigrations :squash echo . echo
squashing migrations with %proj%.settings.%dev% for echo %apps% echo .
python manage.py squashmigrations --settings=%proj%.settings.%dev%
%apps% %3 goto end :: - - - - - - - - - - - - - - end squash :startapp
python manage.py startapp --settings=%proj%.settings.%dev% %apps% goto
end :: - - - - - - - - - - - - - - end startapp :test echo python
manage.py test --settings=%proj%.settings.%test% --verbosity=1 echo
%apps% python manage.py test --settings=%proj%.settings.%test%
--parallel --verbosity=1 %apps% goto end :: - - - - - - - - - - - - - -
end testing :testfail :failfast :fail python manage.py test
--settings=%proj%.settings.%test% --failfast --verbosity=1 %apps% goto
end :: - - - - - - - - - - - - - - end testfail :wall python -Wall
manage.py test --settings=%proj%.settings.%test% --verbosity=1 %apps%
goto end :: - - - - - - - - - - - - - - end wall :warn python -Wall
manage.py runserver --settings=%proj%.settings.%dev% goto end :: - - - -
- - - - - - - - - - end warn :end echo . echo Started: %dtStamp% SET
HOUR=%time:~0,2% SET dtStamp9=0%time:~1,1%:%time:~3,2%:%time:~6,2% SET
dtStamp24=%time:~0,2%:%time:~3,2%:%time:~6,2% if "%HOUR:~0,1%" == " "
(SET dtStamp=%dtStamp9%) else (SET dtStamp=%dtStamp24%) ECHO Finished:
%dtStamp% set json=%app1%\fixtures\initial_data.json if exist %json%
(del %json%) goto bitterend if %1==check ( goto %1 ) if
%1==collectstatic ( goto collectstatic ) if %1==coverage ( goto testcov
) if %1==dumpdata ( goto dumpdata ) if %1==fake ( goto fake ) if
%1==makeemptymigrations ( :: leave apps as is goto makeemptymigrations )
if %1==makemigrations ( :: leave apps as is goto makemigrations ) if
%1==migrate ( if %2xx==xx ( set apps= ) else ( set apps=%2 ) goto
migrate ) if %1==map_csv ( goto map_csv ) if %1==ozone ( goto ozone ) if
%1==remove_stale ( goto remove_stale_contenttypes ) if %1==shell ( goto
shell ) if %1==squashmigrations ( goto squashmigrations ) if
%1==startapp ( goto startapp ) if %1==test ( goto testing ) if
%1==test-pg ( set test=mike-test-pg goto testing ) if %1==testfail (
goto testfail ) if %1==wall ( goto wall ) :bitterend
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
> > an email to
django...@googlegroups.com <javascript:>
> > <mailto:
django-users...@googlegroups.com <javascript:>>.
> <
https://groups.google.com/d/msgid/django-users/d9acdb88-cb4b-496c-998d-0c48ac221b8do%40googlegroups.com?utm_medium=email&utm_source=footer
> <
https://groups.google.com/d/msgid/django-users/d9acdb88-cb4b-496c-998d-0c48ac221b8do%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
django-users...@googlegroups.com
> <mailto:
django-users...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/django-users/0c741c66-3da5-4905-af57-5ebe27476c3co%40googlegroups.com
> <
https://groups.google.com/d/msgid/django-users/0c741c66-3da5-4905-af57-5ebe27476c3co%40googlegroups.com?utm_medium=email&utm_source=footer>.