0

I have an app that was created in an "old" directory using "django-admin startproject businesscontacts"

old location: C:\Users..\backendworkproj\businesscontacts

moved to new location: C:\Users..\backendworkproj\appmasterdata\businesscontacts

Now, of course, the app that was working is now broken. My understanding is that "C:\Users..\backendworkproj\appmasterdata" needs to be put in the PYTHONPATH.

I know that there are other explanations out there - but - I am trying to follow one of the responses listed here: Permanently add a directory to PYTHONPATH

It says: Instead of manipulating PYTHONPATH you can also create a path configuration file. First find out in which directory Python searches for this information:

To me, it is not clear exactly what is to go into the .pth file. I did not see anything stating whether or not a full-path is needed or a realtive-path or ...

In my case,

1. run python -m site --user-site
output => C:\Users\...\AppData\Roaming\Python\Python36\site-packages

2. Made sure that the directory existed

3. echo "$HOME/foo/bar" > "$SITEDIR/somelib.pth"

Again, not sure what is supposed to be in the .pth file - or - what the name of the file should be (with Step #3)

TIA

Update

Never mind. I tried to delete this message but was unable to do so. This is what I did:

In the C:\Users\...Roaming\Python\Python36\site-packages directory, I created a file called appmaster.pth

The contents of the .pth file are: C:\Users\...\backendworkproj\appmasterdata (i.e. the full path to the project)

Things are working fine now.

Casey Harrils
  • 2,099
  • 4
  • 34
  • 66

1 Answers1

1

the django-admin startproject businesscontacts makes a project, dose not make an app.

1.make a new project in the new directory by django-admin startproject newdir/newbusinesscontacts

2.add apps to your project by python manage.py startapp app_name

3.copy old apps files to your new project apps, you just created

4.add app to installed_app in the project settings file

5.python manage.py makemigrations

6.python manage.py migrate

7.python manage.py runserver

pd shah
  • 1,066
  • 2
  • 9
  • 22
  • my mistake. I know that "python manage.py startapp " is used to create apps (it was kinda late over here). I did not need info on how to create a project or app. What was needed was a way to ~move~ the app to a different sub-directory AFTER it has already been created – Casey Harrils Oct 23 '17 at 13:16
  • try to make a new project then make new app with django, then you can copy your code to it, instead of coping all project. – pd shah Oct 24 '17 at 04:55