Wednesday, August 24, 2016

Re: Running Django Project Locally

So,
I have been handed the other part of the project which now contains everything except the manage.py file(which i have created).
Also, the project is quiet old  and some of the dependencies are either no longer being managed or don't exist anymore.(unobase for an example).
As such, i was handed an eggs.zip containing the packages used by the developer.
Now, the question is, how do i install the dependencies from the eggs.py file?
I think its more of a python question than a django issue but i would still appreciate whatever help i can get.



Lekan.

On Wed, Aug 24, 2016 at 10:22 AM, Mike Dewhirst <miked@dewhirst.com.au> wrote:
On 24/08/2016 6:42 PM, Lekan Wahab wrote:
Thanks for getting back to me.
​So, i just figured *manage.py* would also require the *settings.py* which is missing now.
What do i do about that?

That depends. Is the system currently working?

If so there will be a bunch of settings somewhere and the system will work on your local machine.

If not, it might be a big ask to do anything quickly. You'll need to do some research.

In my own projects there are no settings.py files at all. I use a settings directory and in there I have base.py, local.py, mike_test.py staging.py and production.py. Each of these imports common settings from base.py. Here is my local_test.py

from .base import *
SITE_ID = 3
DEBUG = True
TEMPLATE_DEBUG = DEBUG
TEST_RUNNER = 'django.test.runner.DiscoverRunner'

DATABASES = {
    'default': {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": ":memory:",
        "USER": "",
        "PASSWORD": "",
        "HOST": "",
        "PORT": "",
    }
}

You can probably find where the settings are being imported from - grep for ENGINE and that will give you a clue.

Cheers

Mike



Lekan​


On Wed, Aug 24, 2016 at 8:48 AM, Mike Dewhirst <miked@dewhirst.com.au <mailto:miked@dewhirst.com.au>> wrote:

    On 24/08/2016 5:23 PM, Lekan Wahab wrote:

        Good morning,
        I was recently given  a django project to manage at work.

        However, i noticed the project has neither a django-admin.py
        or a manage.py file.
        Is that normal?

    There is usually a manage.py file in the root of the project.
    django-admin.py is put in the Python path when Django is installed.

        If it is, how do i run the project on my local machine for
        testing purposes?


    * Establish a virtualenv setup (optional but recommended)(separate
    topic)
    * install the same version of Django locally (the file structure
    you show indicates a possibly older Django)
    * install the same version of the database server locally
    * dump the database on the server and load it locally
    * mkdir ~/envs
    * cd envs
    |* ||python django-admin.py startproject projname (or use python3)

    At this point you have the bones of the project into which you
    should be able to see where to copy the projname directories and
    files. After doing so ...

    * ~/envs/projname$ python manage.py runserver

    This will probably generate errors indicating which 3rd party
    packages need to be installed on the local machine. In theory when
    they are all installed you should be able to launch the software.
    |
    Good luck

    Mike


        The file structure is something like this:
        Project Name
        app1
        app2
        app3
        app4
        app5
        models.py
        forms.py
        __init__.py
        urls.py
        views.py
        admin.py


        Each app contains the following:
        models.py
        forms.py
        __init__.py
        urls.py
        views.py
        admin.py
        --         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+unsubscribe@googlegroups.com
        <mailto:django-users%2Bunsubscribe@googlegroups.com>
        <mailto:django-users+unsubscribe@googlegroups.com
        <mailto:django-users%2Bunsubscribe@googlegroups.com>>.
        To post to this group, send email to
        django-users@googlegroups.com
        <mailto:django-users@googlegroups.com>
        <mailto:django-users@googlegroups.com
        <mailto:django-users@googlegroups.com>>.
        Visit this group at
        https://groups.google.com/group/django-users
        <https://groups.google.com/group/django-users>.
        To view this discussion on the web visit
        https://groups.google.com/d/msgid/django-users/CAE6v7ocLOQh_HMxiu29%2Br3wLANJ2wjtesyjb79SXmFXpgb8jgw%40mail.gmail.com
        <https://groups.google.com/d/msgid/django-users/CAE6v7ocLOQh_HMxiu29%2Br3wLANJ2wjtesyjb79SXmFXpgb8jgw%40mail.gmail.com>
        <https://groups.google.com/d/msgid/django-users/CAE6v7ocLOQh_HMxiu29%2Br3wLANJ2wjtesyjb79SXmFXpgb8jgw%40mail.gmail.com?utm_medium=email&utm_source=footer
        <https://groups.google.com/d/msgid/django-users/CAE6v7ocLOQh_HMxiu29%2Br3wLANJ2wjtesyjb79SXmFXpgb8jgw%40mail.gmail.com?utm_medium=email&utm_source=footer>>.
        For more options, visit https://groups.google.com/d/optout
        <https://groups.google.com/d/optout>.


    --     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+unsubscribe@googlegroups.com
    <mailto:django-users%2Bunsubscribe@googlegroups.com>.
    To post to this group, send email to django-users@googlegroups.com
    <mailto:django-users@googlegroups.com>.
    Visit this group at https://groups.google.com/group/django-users
    <https://groups.google.com/group/django-users>.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/django-users/f61e75cb-12f3-3fe8-e792-a5ce69f473c3%40dewhirst.com.au
    <https://groups.google.com/d/msgid/django-users/f61e75cb-12f3-3fe8-e792-a5ce69f473c3%40dewhirst.com.au>.


    For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.


--
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+unsubscribe@googlegroups.com <mailto:django-users+unsubscribe@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com <mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAE6v7odmC97UYEV0-scQZdoafoa3%3DFkP5dKUA2nJ%2BA7oCEH7Xw%40mail.gmail.com <https://groups.google.com/d/msgid/django-users/CAE6v7odmC97UYEV0-scQZdoafoa3%3DFkP5dKUA2nJ%2BA7oCEH7Xw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dc011425-c8c5-7a21-c0e4-37ec095220fc%40dewhirst.com.au.

For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAE6v7oeNPAdzEROcAm3Xq41LJ0Q%3DmDCocCCB-Y%3D7NTVne9Rvjg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment