APPS Folder

21 views
Skip to first unread message

stephen osewe

unread,
Feb 9, 2012, 7:27:58 AM2/9/12
to rapi...@googlegroups.com
hallo team,

I have been following up the new doc on the installation of rapidsms,I have been successfull in all areas but for the part that creates the apps folder.

I user "rapidsms-admin.py startapp Polio".

It creates the folder "Polio" but am still missing the apps folder and the apps.py file.

Could someone clarify this for if am missing out on something ?

Regards,
S.O

Tim Akinbo

unread,
Feb 9, 2012, 8:29:32 AM2/9/12
to rapi...@googlegroups.com
Hi Stephen,

One of the design decisions that was taken in the redesign of RapidSMS was to make it more django-like. That means that there is no apps folder any more. When you start your project:

$ rapidsms-admin.py startproject polio
$ cd Polio
$ python manage.py startapp collector

Your app in this case is named collector which is in the project folder polio. Just like any django project, you have a manager: manage.py that you use for running your router, development server, synchronizing your database, etc.

More information about running your project is available on the RapidSMS documentation - http://rapidsms.readthedocs.org/.

Hope that helps.

Tim Akinbo



--
You received this message because you are subscribed to the Google Groups "rapidsms" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rapidsms/-/FSOtqwt78ioJ.
To post to this group, send email to rapi...@googlegroups.com.
To unsubscribe from this group, send email to rapidsms+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rapidsms?hl=en.

stephen osewe

unread,
Feb 9, 2012, 8:36:07 AM2/9/12
to rapi...@googlegroups.com
Hi Akinbo,

Thanks for that information,one more question...in your example,what should be in your "collector" app after running the code to create the app ?
I have runned the same initially and I was missing the app.py ,I just got the below listing;

_init_.py
  models.py
 tests.py
 views.py

Is this right ?
--
stephen osewe
websys software solutions
www.websysltd.com
+254-721-765 824
in...@websysltd.com

Trevor Sinkala

unread,
Feb 9, 2012, 8:41:28 AM2/9/12
to rapi...@googlegroups.com

Hi,

It is likely a bug in rapidsms  that app.py is not created when you run rapidsms-admin.py startapp. But this something you can manually create. Same applies to admin.py.

Thank you,
Trevor

stephen osewe

unread,
Feb 9, 2012, 8:45:35 AM2/9/12
to rapi...@googlegroups.com
Has anyone been in this scene,i mean Getting a similar situatioan
WHERE admin.py and app.py is not created ?

stephen osewe

unread,
Feb 9, 2012, 8:52:32 AM2/9/12
to rapi...@googlegroups.com
hallo again guyz,let me add this issue to the fray......I just bumped
to it when I was running "rapidsms-admin.py syncdb" in my app folder
after making the model

ImportError: Settings cannot be imported, because environment variable
DJANGO_SETTINGS_MODULE is undefined.

Victor Miclovich

unread,
Feb 9, 2012, 8:53:05 AM2/9/12
to rapi...@googlegroups.com
Its happened before. But you can always get a copy of app.py from contrib apps.

Victor Miclovich

unread,
Feb 9, 2012, 8:54:29 AM2/9/12
to rapi...@googlegroups.com
make sure that you have django installed in your python path. Quick te

>>> python
>>> import django

or in your bashrc., you can force django to appear in your python path.

Victor Miclovich

unread,
Feb 9, 2012, 8:55:32 AM2/9/12
to rapi...@googlegroups.com

stephen osewe

unread,
Feb 9, 2012, 9:05:50 AM2/9/12
to rapi...@googlegroups.com
Hi,

If I do the "import django" everything looks fine

On Thu, Feb 9, 2012 at 4:55 PM, Victor Miclovich <vicmic...@gmail.com> wrote:
> http://stackoverflow.com/questions/1641444/why-am-i-getting-this-error-in-django

Victor Miclovich

unread,
Feb 9, 2012, 9:08:14 AM2/9/12
to rapi...@googlegroups.com
Has your situation been resolved yet?

stephen osewe

unread,
Feb 9, 2012, 9:10:37 AM2/9/12
to rapi...@googlegroups.com
Not yet am to test something new I have seen in the link you sent

On Thu, Feb 9, 2012 at 5:08 PM, Victor Miclovich <vicmic...@gmail.com> wrote:
> Has your situation been resolved yet?
>

Tim Akinbo

unread,
Feb 9, 2012, 9:18:20 AM2/9/12
to rapi...@googlegroups.com
Hi Steve,

The only functional difference between a regular django app and a full RapidSMS app (by full I mean with SMS processing) is the presence of the app.py file. This has to be manually created. It's not a bug.

Just like in the django docs, sync'ing your database requires that you use the manager - manage.py.

So instead of rapidsms-admin.py syncdb, you use python manage.py syncdb while you're inside your project folder - so in this hypothetical case, that would be the polio folder and not the collector folder.

Tim Akinbo

On Thu, Feb 9, 2012 at 3:08 PM, Victor Miclovich <vicmic...@gmail.com> wrote:
Has your situation been resolved yet?

--

stephen osewe

unread,
Feb 9, 2012, 9:25:56 AM2/9/12
to rapi...@googlegroups.com
okay,let me clarify something here...for the Project folder (i.e
POLIO) in this thread for illustration purposes,The "python manage.py
syncdb" has executed so well
And I have all the tables created,Where am having a problem is in the
apps,i.e for this thread(collector),After writting the collector's
models.py,i wanted to run the sync code
and that's where am getting the problem,hope thats more clearer...

--

Victor Miclovich

unread,
Feb 9, 2012, 9:28:56 AM2/9/12
to rapi...@googlegroups.com
Hey Steve,

Are you trying to create a ``collectors`` table? If you are, then make sure that every "django app" you create, you add that app to the INSTALLED_APPS lists in the ``settings.py`` file.
There shouldn't be a sycning problem, as for app.py, add that manually.

If there's an error being output, please post here, so we can take a look.

stephen osewe

unread,
Feb 9, 2012, 9:31:55 AM2/9/12
to rapi...@googlegroups.com
Hi,

Thats exactly what am trying to do,and this is the sample from settings.py

INSTALLED_APPS = [

# the essentials.
"django_nose",
"djtables",
"rapidsms",
"Mileage",

BELOW IS THE ERROR.....

sosewe@sosewe-OptiPlex-760:~/RapidDevelopment/Mileage$ rapidsms-admin.py syncdb
Traceback (most recent call last):
File "/usr/local/bin/rapidsms-admin.py", line 26, in <module>
management.execute_from_command_line()
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
line 429, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py",
line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py",
line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/commands/syncdb.py",
line 7, in <module>
from django.core.management.sql import custom_sql_for_model,
emit_post_sync_signal
File "/usr/local/lib/python2.6/dist-packages/django/core/management/sql.py",
line 6, in <module>
from django.db import models
File "/usr/local/lib/python2.6/dist-packages/django/db/__init__.py",
line 14, in <module>
if not settings.DATABASES:
File "/usr/local/lib/python2.6/dist-packages/django/utils/functional.py",
line 276, in __getattr__
self._setup()
File "/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py",
line 40, in _setup
raise ImportError("Settings cannot be imported, because
environment variable %s is undefined." % ENVIRONMENT_VARIABLE)


ImportError: Settings cannot be imported, because environment variable
DJANGO_SETTINGS_MODULE is undefined.

Victor Miclovich

unread,
Feb 9, 2012, 9:36:03 AM2/9/12
to rapi...@googlegroups.com
Please use 

python manage.py syncdb

 (way faster)
or, if you insist on using rapidsms-admin.py then:

export DJANGO_SETTINGS_MODULE=mysite.settings
rapidsms-admin.py sycndb
Note that> in your case it will <name_of_project>.settings i.e. POLIO.settings or polio.settings if you used lowercase

Victor Miclovich

unread,
Feb 9, 2012, 9:38:07 AM2/9/12
to rapi...@googlegroups.com
I realize that you have to either always make sure that settings.py is visible to the "rapidsms-admin.py" command... best if you use python manage.py syncdb instead.

stephen osewe

unread,
Feb 9, 2012, 9:41:18 AM2/9/12
to rapi...@googlegroups.com
Python manage.py syncdb works well for me when am in my project
folder,but in my apps folder it snap;

have a look at this feedback.

sosewe@sosewe-OptiPlex-760:~/RapidDevelopment/Mileage$ python manage.py syncdb
python: can't open file 'manage.py': [Errno 2] No such file or directory

the content of my mileage folder is;
__init__.py
models.py
tests.py
views.py

so its true the mange.py file is indeed missing in there.

Victor Miclovich

unread,
Feb 9, 2012, 9:44:11 AM2/9/12
to rapi...@googlegroups.com
Please always run your manage commands from the root folder.

  • Polio (root folder/project)
      • collector (an application)
      • app_2 (an application)
      • app_2 (an application)
    • settings.py
    • manage.py
    • etc.
rapidsms-admin.py (as of today), creates a manage.py file always (and this file is located in your root folder).

stephen osewe

unread,
Feb 9, 2012, 9:47:09 AM2/9/12
to rapi...@googlegroups.com
Victor,Sure your citation is true,right I got model error which I will
be able to solve.

Thanks alot plus all the members.

Victor Miclovich

unread,
Feb 9, 2012, 9:49:06 AM2/9/12
to rapi...@googlegroups.com
welcome... you have friends in this group :-)

Tim Akinbo

unread,
Feb 9, 2012, 12:51:16 PM2/9/12
to rapi...@googlegroups.com
Steve,

You should only run:

python manage.py syncb

in the project folder and not within the app folder. As Victor mentioned, once your app is in the INSTALLED_APPS array, the manager will find the corresponding models.py and create the models accordingly.


On Thu, Feb 9, 2012 at 3:49 PM, Victor Miclovich <vicmic...@gmail.com> wrote:
welcome... you have friends in this group :-)
Reply all
Reply to author
Forward
0 new messages