0

I am using Cloud9 to develop Django app. I used the command: python manage.py runserver $PORT:$IP to launch the development server, and added https for css and scripts that will be loaded from external sites. Things are going OK, except for the foo.com/admin page, it takes a long time for me to access the login page, and the style of admin page seems to be lost.

How can I fix it?

update 01

after looking into the issue, I found the problem is somehow caused by the virtualenv, when I start my virtualenv install Django using pip and then start the development server, the admin page is loading slowly as what I had. But when I deactivate my virtualenv, and use the default Django provided by Cloud9, the admin page is normal again.

Did anyone experience the same thing?

lokheart
  • 23,743
  • 39
  • 98
  • 169
  • Not sure why the access is slow. However I had a similar problem with the CSS being broken on the admin page. Turned out that the django environment couldn't locate the admin staticfiles. Had to make sure that `STATIC_URL` was set in my `settings.py` file. Then moved the admin's static files to the folder that was set in `settings.py`. However I *think* that the proper way to do it would be to use the staticfiles app as mentioned in the [documentation](https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/) – Stack of Pancakes Oct 11 '14 at 03:07
  • This might be helpful. http://stackoverflow.com/a/10047615/3540618 It's an old post but still conforms to the current [docs](https://docs.djangoproject.com/en/dev/howto/static-files/deployment/) – Stack of Pancakes Oct 11 '14 at 03:11
  • thanks @StackofPancakes , I tried the way mentioned in official documentation, added `STATIC_ROOT` as the absolute path in my Cloud9 IDE, run `collectstatic` and `runserver`,sadly it is still not working. – lokheart Oct 11 '14 at 03:31
  • If you are still having issues, you can send an email to support@c9.io and we can take a look. – Nikolai Onken Oct 14 '14 at 09:36

1 Answers1

0

Sounds like you could be missing the static resources.

After running collectstatic you need to move those resources [a directory named "admin"] to the same location your STATIC_ROOT points to (next to the root folder of your apps static files if you followed that convention from the docs).

Mike S
  • 1,537
  • 2
  • 11
  • 15
  • if i created the static folder at `\foo\static`, should the new admin folder be at `\foo\static\admin` or `\foo\admin`? – lokheart Oct 17 '14 at 04:36
  • It may help to double check and include your static root and static url settings. I'm not familiar with your hosting environment but it seems strange that you're running the development command on an actual server. Check the box titled 'serving the files' here https://docs.djangoproject.com/en/dev/howto/static-files/ – Mike S Oct 17 '14 at 05:07