Mario,

It's not the best to re-open a 2.5 year old thread :) Better to start a new
one, link to the old one, and state what you think is different.

I believe your use case can be fit with a custom ruserver management
command to override the original as Shai suggested:

> from (...)runserver import Command as BaseCommand
>
> class Command(BaseCommand):
>       def handle(self, *args, **options):
>               options.setdefault('addrport', '0.0.0.0:8000')
>               super(Command, self).handle(*args, **options)

You can change the options.setdefault line to set the port in addrport from
a new setting you invent and put in your config file, such as
MYPROJECTNAME_RUNSERVER_PORT = 8001

On Thu, 18 Jul 2019 at 22:21, Mario Frasca <[email protected]> wrote:

> was this rejected?
> my use case is: I have a single django program, which I run in multiple
> instances, each on a different port and connecting to a different
> database.  for each instance, I have a separate `config_INSTANCE.py` file.
> the database settings fit in the `config` file, but I have to put the port
> in a batch file, or something else, outside the config file.  it feels as
> if I were doing something which isn't allowed...
> I don't need to run the program on a single different port, I need
> different config files each stating a different port.
>
> On Tuesday, 17 January 2017 02:21:46 UTC-5, Shai Berger wrote:
>>
>> I am -1 on adding a setting to handle a use-case that can be handled by
>> users
>> with a 6-line file:
>>
>> On Monday 28 November 2016 16:05:39 Shai Berger wrote:
>> >
>> > It seems all you need in the overridden runserver is:
>> >
>> > from (...)runserver import Command as BaseCommand
>> >
>> > class Command(BaseCommand):
>> >         def handle(self, *args, **options):
>> >                 options.setdefault('addrport', '0.0.0.0:8000')
>> >                 super(Command, self).handle(*args, **options)
>> >
>> > What am I missing?
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/02fd8076-a850-4455-b2ae-f065a2d8e98f%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/02fd8076-a850-4455-b2ae-f065a2d8e98f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Adam

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM142SfG26YiizZNq0yrxEGJTwtcy76W-1zExPKcf1F5CA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to