facebookarchive / augmented-traffic-control

Augmented Traffic Control: A tool to simulate network conditions
https://facebook.github.io/augmented-traffic-control
Other
4.33k stars 599 forks source link

Environment Compatibility Issues #296

Closed philliplu1990 closed 8 years ago

philliplu1990 commented 8 years ago

Hi guys, Would like your assistance. Running Python 2.7.6 Django 1.10 I have followed your instructions and have run into some issues:

"/dev/atc/venv/local/lib/python2.7/site-packages/django/conf/urls/init.py", line 85, in url raise TypeError('view must be a callable or a list/tuple in the case of include().')

I get this error when I run: python manage.py migrate

This is after I have changed all urls.py files to use lists instead of patterns since patterns has been deprecated starting 1.8 ~/dev/atc/venv/local/lib/python2.7/site-packages/atc_api/urls.py ~/dev/atc/venv/local/lib/python2.7/site-packages/atc_demo_ui/urls.py

What can I do to remedy this?

chantra commented 8 years ago

@philliplu1990 Yeah, django 1.10 is not supported yet. First, maybe posting a diff of your change will help to better understand what your change is about. I assume you are referencing to https://docs.djangoproject.com/en/1.10/releases/1.8/#django-conf-urls-patterns

and the fact that it got removed in https://docs.djangoproject.com/en/1.10/releases/1.10/#features-removed-in-1-10

You quick solution is to downgrade to django 1.9.

Better, you can clone ATC repository and run from master, see https://github.com/facebook/augmented-traffic-control#developing-on-atc fix the issue and create a pull request.

philliplu1990 commented 8 years ago

@chantra Thank you for your response. I created a new virtualenv and installed django 1.9 as suggested. When running the suggested command to install pkgs for pkg in atc_thrift atcd \ django-atc-api django-atc-demo-ui django-atc-profile-storage do pip install $pkg done It seems like django is automatically upgraded to 1.10.1 Regardless, I followed the steps to edit settings.py and urls.py as suggested. When running: python manage.py migrate I get the same error of course. Even if I downgraded to 1.9 before starting atcui django project, I would see the same issue. The problem seems to stem from urls.py in atc_api and atc_demo_ui referencing urls.patterns

~/dev/atc/venv/local/lib/python2.7/site-packages/atc_api/urls.py ~/dev/atc/venv/local/lib/python2.7/site-packages/atc_demo_ui/urls.py

Hence in my original post, I edited these files to use urlpatterns = [.....] format instead of urlpatterns = patterns( ' ', ....) format.

Thank you

philliplu1990 commented 8 years ago

@chantra I downgraded to 1.7 Started project named atcui Installed pkgs Reinstalled 1.7 Edited settings.py and urls.py python manage.py migrate Runs successfully

ATC server is up and running now using other commands. When I go to the x.x.x.x/8000 webpage I get an interesting issue: "cannot import name DurationField" DurationField was added in Django 1.8 :/ https://docs.djangoproject.com/en/1.10/releases/1.8/

Probably getting this error because I automatically grabbed latest version of rest_framework (3.4.6) via the atc pkgs. DurationField was added in 3.1.3. http://www.django-rest-framework.org/topics/release-notes/#31x-series

Is there a way we can remedy this?

I am surprised more people haven't run into these issues, granted I am also very inexperienced with programming. I've been fumbling around and figuring things out as I go, but there are a lot of compatibility issues when following the documentation.

I do appreciate your help. Thank you

Environment:

Request Method: GET Request URL: http://x.x.x.x:8000/

Django Version: 1.7 Python Version: 2.7.6 Installed Applications: ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'atc_api', 'bootstrap_themes', 'django_static_jquery', 'atc_demo_ui', 'atc_profile_storage') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware')

Traceback: File "/home/xxxx/dev/atc/venv2/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response

  1. resolver_match = resolver.resolve(request.path_info) File "/home/xxxx/dev/atc/venv2/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
  2. for pattern in self.url_patterns: File "/home/xxxx/dev/atc/venv2/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns
  3. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/home/xxxx/dev/atc/venv2/local/lib/python2.7/site-packages/django/core/urlresolvers.py" in urlconf_module
  4. self._urlconf_module = import_module(self.urlconf_name) File "/usr/lib/python2.7/importlib/init.py" in import_module
  5. import(name) File "/home/xxxx/dev/atc/atcui2/atcui2/urls.py" in
  6. url(r'^api/v1/', include('atc_api.urls')), File "/home/xxxx/dev/atc/venv2/local/lib/python2.7/site-packages/django/conf/urls/init.py" in include
  7. urlconf_module = import_module(urlconf_module) File "/usr/lib/python2.7/importlib/init.py" in import_module
  8. import(name) File "/home/xxxx/dev/atc/venv2/local/lib/python2.7/site-packages/atc_api/urls.py" in
  9. from atc_api.views import AtcApi, AuthApi, TokenApi File "/home/xxxx/dev/atc/venv2/local/lib/python2.7/site-packages/atc_api/views.py" in
  10. from atc_api.serializers import SettingSerializer, DeviceSerializer File "/home/xxxx/dev/atc/venv2/local/lib/python2.7/site-packages/atc_api/serializers.py" in
  11. from rest_framework import serializers File "/home/xxxx/dev/atc/venv2/local/lib/python2.7/site-packages/rest_framework/serializers.py" in
  12. from django.db.models import DurationField as ModelDurationField

Exception Type: ImportError at / Exception Value: cannot import name DurationField

chantra commented 8 years ago

The durationfield was fixed as part of #279 .

I don't have a good solution to give you but debugging the issue and fixing forward to support django 1.10. This is a standard django issue more than anything super specific to atc.

chantra commented 8 years ago

O'rite, I got something working with 1.10...

after the changes for urls.py, there is also some changes that need to happen in settings.py (may not apply to your case though).

Try https://github.com/facebook/augmented-traffic-control/pull/297

chantra commented 8 years ago

@philliplu1990 did you get a chance to test with those patches?

philliplu1990 commented 8 years ago

@chantra Yes fixed worked! Thank you very much for your assistance. My ATC server is up and running. Thank you again