On 10/07/2020 12:11 am, Kshitij Kotasthane wrote:
Doing this every time I run the server is really inconveninent as I said above.

On Thursday, 9 July 2020 00:40:54 UTC+5:30, Luciano Martins wrote:

    python manage.py runserver localhost:5000

    Em quarta-feira, 8 de julho de 2020 12:56:58 UTC-3, Kshitij
    Kotasthane escreveu:

        I recently started using django and because port 8000 on my PC
        was already occupied, I had to modify the runserver.py file
        directly to start on another port. By default, shouldn't there
        be an option in manage.py or settings.py to modify the port to
        start the test server on? Or am I missing something?

        Because this is very inconvenient as well,

        |
        python manage.py runserver 5000
        |


Because I develop on Windows and also hate typing I wrote a batch file to launch manage.py with the correct settings.

I call it run-local.bat

It has a whole mess of vars at the top and I can edit those to make it work for different projects. I also use it for most of the manage.py commands like ...

run-local test
run-local coverage
run-local makemigrations

Depending on what I'm doing it uses different settings files. For example, tests with SQLite versus PostgreSQL.

I even used it recently to run a series of psql commands to adjust the database when retrofitting one project with a custom user. That was delightful because I could repeatedly reload the production database locally and eventually got the migration perfect prior to saving run-local.bat as run-prd.bat changing the database setting vars and migrating the production database. I was very pleased with that.

I also run Ubuntu machines and if I was developing on Linux or Mac I'm sure I could build a run-local.sh script there.

If you (or anyone) would like a copy of my run-local.bat just ask

Cheers

Mike





--
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+unsubscr...@googlegroups.com <mailto:django-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d9acdb88-cb4b-496c-998d-0c48ac221b8do%40googlegroups.com <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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/be8889a1-3ab5-29bf-c4ae-1603dbd953cf%40dewhirst.com.au.

Reply via email to